diff options
author | Mark Spruiell <mes@zeroc.com> | 2013-04-19 14:25:08 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2013-04-19 14:25:08 -0700 |
commit | 887b627bedf2c3232a598b10a91ac9cece0aa067 (patch) | |
tree | 94b4916b8a8dd44f1cb7b5fd34983c2791ba9862 | |
parent | SOCKS support for Java (diff) | |
download | ice-887b627bedf2c3232a598b10a91ac9cece0aa067.tar.bz2 ice-887b627bedf2c3232a598b10a91ac9cece0aa067.tar.xz ice-887b627bedf2c3232a598b10a91ac9cece0aa067.zip |
merging Protocol Buffers into master, updated for Ice 3.5
76 files changed, 5812 insertions, 4 deletions
diff --git a/distribution/bin/makeprotobufdist.py b/distribution/bin/makeprotobufdist.py new file mode 100755 index 00000000000..1111722badb --- /dev/null +++ b/distribution/bin/makeprotobufdist.py @@ -0,0 +1,230 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import os, sys, fnmatch, re, getopt +from stat import * + +distDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.append(os.path.join(distDir, "lib")) +import DistUtils + +# +# This is an explicit list of some files to remove. The +# other files are all removed by reversing the below list. +# +filesToRemove = [ + "./cpp/config/Make.rules.mak", \ + "./cpp/config/Make.rules.msvc", \ + "./protobuf/config/Make.rules.mak", \ + "./protobuf/demo/cpp/Makefile.mak", \ +] + +# List of files & subdirectories to keep, all others are removed. +filesToKeep = [ + "./LICENSE", \ + "./config/Make.common.rules", \ + "./cpp/config", \ + "./java/config", \ + "./protobuf/config", \ + "./protobuf/demo", \ + "./protobuf/README", \ + "./protobuf/ICE_PROTOBUF_LICENSE", \ +] + +# +# Files from the top-level, cpp and java config directories to include in the +# source distribution config directory. +# +configFiles = [ \ + "Make.*", \ + "common.xml", \ + "build.properties", \ +] + +def pathInList(p, l): + for f in l: + # Slower, but more accurate. + #if os.path.samefile(p, f): + if p == f: + return True + return False + +# This takes a list of files to keep, and generates from that a list +# of files to remove. +def genRemoveList(l): + files = [] + dirs = [] + for root, dirnames, filenames in os.walk('.'): + mod = [] + for d in dirnames: + if pathInList(os.path.join(root, d), filesToKeep): + mod.append(d) + for e in mod: + del dirnames[dirnames.index(e)] + + for f in filenames: + if not pathInList(os.path.join(root, f), filesToKeep): + files.append(os.path.join(root, f)) + + for f in dirnames: + dirs.append(os.path.join(root, f)) + dirs.reverse() + files.extend(dirs) + return files + +# +# Program usage. +# +def usage(): + print "Usage: " + sys.argv[0] + " [options] version [tag]" + print + print "Options:" + print "-h Show this message." + print "-v Be verbose." + print "-c DIR Compare distribution to the one from DIR and" + +# +# Check arguments +# +verbose = 0 +tag = "HEAD" +compareToDir = None + +try: + opts, args = getopt.getopt(sys.argv[1:], "hvc:k:") +except getopt.GetoptError: + usage() + sys.exit(1) + +for o, a in opts: + if o == "-h": + usage() + sys.exit(0) + elif o == "-v": + verbose = 1 + elif o == "-c": + compareToDir = a + +if len(args) < 1 or len(args) > 2: + usage() + sys.exit(1) + +if len(args) == 1: + version = args[0] + +if len(args) == 2: + version = args[0] + tag = args[1] + +cwd = os.getcwd() + +# +# Remove any existing "distprotobuf-" directory and create a new one +# and sub-directories for the each source distribution. +# +distDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "distprotobuf-" + tag.replace('/', '-'))) +if os.path.exists(distDir): + DistUtils.remove(distDir) +os.mkdir(distDir) + +print "Creating " + version + " source distributions in " + distDir + +srcDir = os.path.join(distDir, "IceProtobuf-" + version) + +# +# Extract the sources with git archive using the given tag. +# +print "Creating git archive using " + tag + "...", +sys.stdout.flush() +os.system("git archive --prefix=IceProtobuf-" + version + "/ " + tag + " | ( cd " + distDir + " && tar xfm - )") +print "ok" + +os.chdir(os.path.join(srcDir)) + +print "Walking through distribution to fix permissions, versions, etc...", +sys.stdout.flush() + +for root, dirnames, filesnames in os.walk('.'): + + for f in filesnames: + filepath = os.path.join(root, f) + if f == ".gitignore" or f == "expect.py": + os.remove(filepath) + else: + + # Fix version of README/INSTALL files + if fnmatch.fnmatch(f, "README*") or fnmatch.fnmatch(f, "INSTALL*"): + DistUtils.fixVersion(filepath, version) + + DistUtils.fixFilePermission(filepath) + + for d in dirnames: + os.chmod(os.path.join(root, d), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) # rwxr-xr-x + +print "ok" + +# +# Remove or move non-public files out of source distribution. +# +print "Removing non-IceProtobuf directories and files...", +sys.stdout.flush() +for x in genRemoveList(filesToKeep): + DistUtils.remove(x, False) + +for x in filesToRemove: + DistUtils.remove(x) +print "ok" + +# +# Copy distribution-specific install files. +# +print "Copying protobuf install files...", +#move(os.path.join("distribution", "src", "protobuf", "README"), os.path.join("README")) + +# +# Move demo directories to the correct places. +# +DistUtils.move(os.path.join("protobuf", "demo"), os.path.join("demo")) +DistUtils.move(os.path.join("protobuf", "README"), os.path.join("README")) +DistUtils.move(os.path.join("protobuf", "ICE_PROTOBUF_LICENSE"), os.path.join("ICE_PROTOBUF_LICENSE")) + +for d in ["cpp", "java"]: + DistUtils.copyMatchingFiles(os.path.join(d, "config"), os.path.join("config"), configFiles) + +DistUtils.remove("cpp") +DistUtils.remove("java") +DistUtils.remove("protobuf") + +print "ok" + +# +# Everything should be clean now, we can create the source distributions archives +# +print "Archiving..." +sys.stdout.flush() +os.chdir(distDir) + +DistUtils.tarArchive(srcDir, verbose) +DistUtils.zipArchive(srcDir, verbose) + +# +# Write source distribution report in README file. +# +DistUtils.writeSrcDistReport("IceProtobuf-", version, compareToDir, [srcDir]) + +# +# Done. +# +print "Cleaning up...", +sys.stdout.flush() +DistUtils.remove(srcDir) +print "ok" + +os.chdir(cwd) diff --git a/distribution/makedist.py b/distribution/makedist.py index 5fb02f03a46..73ba662a8fe 100755 --- a/distribution/makedist.py +++ b/distribution/makedist.py @@ -274,6 +274,9 @@ os.chdir(srcDir) print "Walking through distribution to fix permissions, versions, etc...", sys.stdout.flush() +remove("protobuf") +remove("distribution/bin/makeprotobufdist.py") + fixVersion("RELEASE_NOTES", *versions) fixVersion(os.path.join("cpp", "config", "glacier2router.cfg"), *versions) fixVersion(os.path.join("cpp", "config", "icegridregistry.cfg"), *versions) @@ -335,6 +338,12 @@ os.chdir(winSrcDir) print "Walking through distribution to fix permissions, versions, etc...", sys.stdout.flush() +# +# Remove files and directories that should not be included. +# +remove("protobuf") +remove("distribution/bin/makeprotobufdist.py") + fixVersion("RELEASE_NOTES", *versions) fixVersion(os.path.join("cpp", "config", "glacier2router.cfg"), *versions) fixVersion(os.path.join("cpp", "config", "icegridregistry.cfg"), *versions) diff --git a/protobuf/FixUtil.py b/protobuf/FixUtil.py new file mode 100755 index 00000000000..983f532b470 --- /dev/null +++ b/protobuf/FixUtil.py @@ -0,0 +1,401 @@ +#!/usr/bin/env python + +import os, sys, shutil, fnmatch, re, glob, getopt +from stat import * + +def copyright(commentMark, product, license): + result = [ ] + result.append(commentMark + " **********************************************************************\n") + result.append(commentMark + "\n") + result.append(commentMark + " Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.\n") + result.append(commentMark + "\n") + line1 = commentMark + (" This copy of %s is licensed to you under the terms described in the") % product + line2 = commentMark + if len(line1) >= 72: + line2 = commentMark + line1[line1.rfind(" ", 0, 72):] + line1 = line1[:line1.rfind(" ", 0, 72)] + line2 += (" %s file included in this distribution.") % license + line3 = commentMark + if len(line2) >= 72: + line3 = commentMark + line2[line2.rfind(" ", 0, 72):] + line2 = line2[:line2.rfind(" ", 0, 72)] + result.append(line1 + "\n") + result.append(line2 + "\n") + if line3 != commentMark: + result.append(line3 + "\n") + result.append(commentMark + "\n") + result.append(commentMark + " **********************************************************************\n") + return result + +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** +def replaceCopyright(file, commentMark, commentBegin, commentEnd, newCopyrightLines): + oldFile = open(file, "r") + oldLines = oldFile.readlines() + + done = 0 + commentFound = 0 + copyrightFound = 0 + + beforeCopyrightLines = [] + oldCopyrightLines = [] + newLines = [] + + justDone = 0 + isWindowsEOL = False + + if commentBegin == "": + for x in oldLines: + if not commentFound and (not x.startswith(commentMark) or x.startswith("#!/usr/bin/env")): + beforeCopyrightLines.append(x) + elif not done and x.startswith(commentMark): + commentFound = 1 + if not copyrightFound and x.lower().find("copyright") != -1: + copyrightFound = 1 + if x.endswith("\r\n"): + isWindowsEOL = True + # skip this comment line + oldCopyrightLines.append(x) + else: + if not done: + done = 1 + justDone = 1 + + # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script) + if justDone == 1: + newLines.append(x) + if x != "\n": + justDone = 0 + else: + justDone = 2 + elif justDone == 2: + if x != "\n": + newLines.append(x) + justDone = 0 + else: + newLines.append(x) + else: + for x in oldLines: + if not done: + if x.startswith(commentBegin): + commentFound = 1 + if commentFound: + if not copyrightFound and x.find("Copyright") != -1: + copyrightFound = 1 + if x.endswith("\r\n"): + isWindowsEOL = True + + # skip this comment line + if x.find(commentEnd) != -1: + done = 1 + justDone = 1 + else: + beforeCopyrightLines.append(x) + else: + # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script) + if justDone == 1: + newLines.append(x) + if x != "\n": + justDone = 0 + else: + justDone = 2 + elif justDone == 2: + if x != "\n": + newLines.append(x) + justDone = 0 + else: + newLines.append(x) + + + oldFile.close() + + if copyrightFound and newCopyrightLines != oldCopyrightLines: + + mode = os.stat(file)[ST_MODE] + + #origFile = file + ".orig" + #shutil.copy2(file, origFile) + + newFile = open(file, "w") + newFile.writelines(beforeCopyrightLines) + if isWindowsEOL: + newFile.writelines([l.replace('\n', '\r\n') for l in newCopyrightLines]) + else: + newFile.writelines(newCopyrightLines) + + # + # Hack to keep the .err files + # + if fnmatch.fnmatch(file, "*test/Slice/errorDetection/*.ice") > 0: + newFile.write("\n") + + newFile.writelines(newLines) + newFile.close() + + os.chmod(file, S_IMODE(mode)) + print "------ Replaced copyright in " + file + " -------" + + return copyrightFound + +# +# Replace alls copyrights +# +def replaceAllCopyrights(path, product, license, recursive): + + cppCopyright = copyright("//", product, license) + mcCopyright = copyright("; //", product, license) + makefileCopyright = copyright("#", product, license) + vbCopyright = copyright("'", product, license) + pythonCopyright = makefileCopyright + rubyCopyright = makefileCopyright + xmlCopyright = [] + xmlCopyright.append("<!--\n"); + xmlCopyright.extend(copyright("", product, license)) + xmlCopyright.append("-->\n"); + + files = os.listdir(path) + for x in files: + fullpath = os.path.join(path, x); + if os.path.isdir(fullpath) and not os.path.islink(fullpath): + if recursive: + replaceAllCopyrights(fullpath, product, license, True) + else: + + commentMark = "" + commentBegin = "" + commentEnd = "" + copyrightLines = [] + skip = 0 + + if x == "config" or x == ".depend" or x == ".dummy" or fnmatch.fnmatch(x, "*.dsp") or fnmatch.fnmatch(x, "*.sln") or fnmatch.fnmatch(x, "*.vdproj") or fnmatch.fnmatch(x, "*.err") or fnmatch.fnmatch(x, "*.class") or fnmatch.fnmatch(x, "*.ico") or fnmatch.fnmatch(x, "*.gif") or fnmatch.fnmatch(x, "*.jpg") or fnmatch.fnmatch(x, "*.orig"): + print "Skipping file " + fullpath + ": no copyright needed" + skip = 1 + elif fnmatch.fnmatch(x, "Make*") or fnmatch.fnmatch(x, "*.properties"): + commentMark = "#" + copyrightLines = makefileCopyright + elif fnmatch.fnmatch(x, "*.h") or fnmatch.fnmatch(x, "*.cpp") or fnmatch.fnmatch(x, "*.cs") or \ + fnmatch.fnmatch(x, "*.java") or fnmatch.fnmatch(x, "*.l") or fnmatch.fnmatch(x, "*.y") or \ + fnmatch.fnmatch(x, "*.m") or fnmatch.fnmatch(x, "*.mm"): + commentMark = "//" + copyrightLines = cppCopyright + elif fnmatch.fnmatch(x, "*.ice") and not fnmatch.fnmatch(x, "IllegalIdentifier.ice"): + commentMark = "//" + copyrightLines = cppCopyright + elif fnmatch.fnmatch(x, "*.py"): + commentMark = "#" + copyrightLines = pythonCopyright + elif fnmatch.fnmatch(x, "*.def"): + commentMark = "#" + copyrightLines = pythonCopyright + elif fnmatch.fnmatch(x, "*.cnf"): + commentMark = "#" + copyrightLines = pythonCopyright + elif fnmatch.fnmatch(x, "*.rb"): + commentMark = "#" + copyrightLines = rubyCopyright + elif fnmatch.fnmatch(x, "*.mc"): + commentMark = "; //" + copyrightLines = mcCopyright + elif fnmatch.fnmatch(x, "*.vb"): + commentMark = "'" + copyrightLines = vbCopyright + elif fnmatch.fnmatch(x, "*.xml") or fnmatch.fnmatch(x, "*.xaml"): + commentBegin = "<!--" + commentEnd = "-->" + copyrightLines = xmlCopyright + else: + print "***** Skipping file " + fullpath + ": unknown type" + skip = 1 + + if not skip: + if replaceCopyright(fullpath, commentMark, commentBegin, commentEnd, copyrightLines) == 0: + print "***** WARNING: Did not find copyright in " + fullpath + +# +# Version patterns +# +vpatCheck = "[0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*)$" +vpatParse = "([0-9]+)\.([0-9]+)(\.[0-9]+|b[0-9]*)" +vpatMatch = "([0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*))" + +def commaVersion(version): + major = majorVersion(version) + minor = minorVersion(version) + patch = patchVersion(version) + return ("%s,%s,%s" % (major, minor, patch)) + +def intVersion(version): + r = re.search(vpatParse, version) + major = int(r.group(1)) + minor = int(r.group(2)) + gr3 = r.group(3) + patch = -1 + if gr3.startswith("."): + patch = int(gr3[1:]) + else: + if len(gr3) > 1: + patch = 50 + int(gr3[1:]) + else: + patch = 51 + return ("%2d%02d%02d" % (major, minor, patch)).strip() + +def betaVersion(version): + r = re.search(vpatParse, version) + if r.group(3).startswith("b"): + return "b" + else: + return "" + +def soVersion(version): + r = re.search(vpatParse, version) + major = int(r.group(1)) + minor = int(r.group(2)) + v = ("%d%d" % (major, minor)).strip() + if r.group(3).startswith("b"): + return v + "b" + else: + return v + +def majorVersion(version): + r = re.search(vpatParse, version) + major = int(r.group(1)) + return ("%d" % (major)).strip() + +def minorVersion(version): + r = re.search(vpatParse, version) + minor = int(r.group(2)) + return ("%d" % (minor)).strip() + +def shortVersion(version): + r = re.search(vpatParse, version) + major = int(r.group(1)) + minor = int(r.group(2)) + return ("%d.%d" % (major, minor)).strip() + +def patchVersion(version): + r = re.search(vpatParse, version) + + gr3 = r.group(3) + patch = -1 + if gr3.startswith("."): + patch = int(gr3[1:]) + else: + if len(gr3) > 1: + patch = 50 + int(gr3[1:]) + else: + patch = 51 + + return ("%d" % (patch)).strip() + +# +# Find files matching a pattern. +# +def find(path, patt): + result = [ ] + files = os.listdir(path) + for x in files: + fullpath = os.path.join(path, x); + if os.path.isdir(fullpath) and not os.path.islink(fullpath): + result.extend(find(fullpath, patt)) + elif fnmatch.fnmatch(x, patt): + result.append(fullpath) + return result + + +# +# Replace a string matched by the first group of regular expression. +# +# For example: the regular expression "ICE_STRING_VERSION \"([0-9]*\.[0-9]*\.[0-9]*)\"" +# will match the string version in "ICE_STRING_VERSION "2.1.0"" and will replace it with +# the given version. +# +def fileMatchAndReplace(filename, matchAndReplaceExps, warn=True): + + mode = os.stat(filename).st_mode + oldConfigFile = open(filename, "r") + newConfigFile = open(filename + ".new", "w") + + # + # Compile the regular expressions + # + regexps = [ ] + for (regexp, replace) in matchAndReplaceExps: + regexps.append((re.compile(regexp), replace)) + + # + # Search for the line with the given regular expressions and + # replace the matching string + # + updated = False + for line in oldConfigFile.readlines(): + for (regexp, replace) in regexps: + match = regexp.search(line) + if match != None: + oldLine = line + line = oldLine.replace(match.group(1), replace) +# print oldLine + line + updated = True + break + newConfigFile.write(line) + + newConfigFile.close() + oldConfigFile.close() + + if updated: + print "updated " + filename + os.rename(filename + ".new", filename) + os.chmod(filename, S_IMODE(mode)) + elif warn: + print "warning: " + filename + " didn't contain any version" + os.unlink(filename + ".new") + +# +# Replace all occurences of a regular expression in a file +# +def fileMatchAllAndReplace(filename, matchAndReplaceExps): + + oldFile = open(filename, "r") + newFile = open(filename + ".new", "w") + + # + # Compile the regular expressions + # + regexps = [ ] + for (regexp, replace) in matchAndReplaceExps: + regexps.append((re.compile(regexp), replace)) + + # + # Search for all lines with the given regular expressions and + # replace the matching string + # + updated = False + for line in oldFile.readlines(): + for (regexp, replace) in regexps: + match = regexp.search(line) + if match != None: + oldLine = line + line = oldLine.replace(match.group(1), replace) + updated = True + newFile.write(line) + + newFile.close() + oldFile.close() + + if updated: + print "updated " + filename + os.rename(filename + ".new", filename) + else: + print "warning: " + filename + " didn't contain any version" + os.unlink(filename + ".new") + +def checkVersion(version): + if not re.match(vpatCheck, version): + print "invalid version number: " + version + " (it should have the form 3.2.1 or 3.2b or 3.2b2)" + sys.exit(0) diff --git a/protobuf/ICE_PROTOBUF_LICENSE b/protobuf/ICE_PROTOBUF_LICENSE new file mode 100644 index 00000000000..c42b7bba7b0 --- /dev/null +++ b/protobuf/ICE_PROTOBUF_LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. + +This copy of Ice Protobuf is free software; you can redistribute it +and/or modify it under the terms of the GNU General Public License +version 2 as published by the Free Software Foundation. + +Ice Protobuf is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +The GNU General Public License is often shipped with GNU software, and +is generally kept in a file called COPYING or LICENSE. If you do not +have a copy of the license, write to the Free Software Foundation, 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +In addition, as a special exception, ZeroC, Inc. gives permission to +link Ice Protobuf with the OpenSSL library (or with modified versions +of OpenSSL that use the same license as OpenSSL) and distribute linked +combinations of Ice Protobuf with any of these libraries. + +You must obey the GNU General Public License version 2 in all respects +for all of the code used other than these libraries. If you modify +this copy of Ice Protobuf, you may extend this exception to your +version of Ice Protobuf, but you are not obligated to do so. If you do +not wish to do so, delete this exception statement from your version. diff --git a/protobuf/README b/protobuf/README new file mode 100644 index 00000000000..c1472702d00 --- /dev/null +++ b/protobuf/README @@ -0,0 +1,11 @@ +This archive contains sample applications that demonstrate how to +integrate Google Protocol Buffers with Ice. + +Included are demos written in C++, Java and Python. The demos were +tested with: + + - Ice 3.5.0 + - Google Protocol Buffers 2.5.0 + +Please see the READMEs in the specific language directories for +more information on building and running each demo. diff --git a/protobuf/config/Make.rules b/protobuf/config/Make.rules new file mode 100644 index 00000000000..61102102fad --- /dev/null +++ b/protobuf/config/Make.rules @@ -0,0 +1,125 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# Define OPTIMIZE as yes if you want to build with +# optimization. Otherwise Ice is build with debug information. +# +#OPTIMIZE = yes + +# +# Define LP64 as yes or no if you want force a 32 or 64 bit. The +# default is platform-dependent +# +#LP64 ?= yes + +# +# If Ice is not installed in a standard location, set ICE_HOME to the +# Ice installation directory. +# +#ICE_HOME ?= /opt/Ice-3.5.0 + +# ---------------------------------------------------------------------- +# Don't change anything below this line! +# ---------------------------------------------------------------------- + +# +# Common definitions +# +ice_language = cpp +slice_translator = slice2cpp +ice_require_cpp = 1 + +ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0) + include $(top_srcdir)/config/Make.common.rules +else + include $(top_srcdir)/../config/Make.common.rules +endif + +# +# Platform specific definitions +# +ifeq ($(shell test -f $(top_srcdir)/config/Make.rules.$(UNAME) && echo 0),0) + include $(top_srcdir)/config/Make.rules.$(UNAME) +else + include $(top_srcdir)/../cpp/config/Make.rules.$(UNAME) +endif + +ifdef ice_src_dist + ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) + ICE_LIB_DIR = -L$(ice_cpp_dir)/lib + else + ICE_LIB_DIR = -L$(ice_cpp_dir)/$(libsubdir) + endif + ICE_FLAGS = -I$(ice_cpp_dir)/include +endif +ifdef ice_bin_dist + ifneq ($(ice_dir), /usr) + ICE_LIB_DIR = -L$(ice_dir)/$(libsubdir) + ICE_FLAGS = -I$(ice_dir)/include + endif +endif +ICE_LIBS = $(ICE_LIB_DIR) $(LIBS) + +ICECPPFLAGS = -I$(slicedir) +SLICE2CPPFLAGS = $(ICECPPFLAGS) + +ifdef ice_src_dist + ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) + SLICEPARSERLIB = $(ice_cpp_dir)/lib/$(call mklibfilename,Slice,$(VERSION)) + SLICE2CPP = $(ice_cpp_dir)/bin/slice2cpp + else + SLICEPARSERLIB = $(ice_cpp_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION)) + SLICE2CPP = $(ice_cpp_dir)/$(binsubdir)/slice2cpp + endif +else + SLICEPARSERLIB = $(ice_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION)) + SLICE2CPP = $(ice_dir)/$(binsubdir)/slice2cpp +endif + +EVERYTHING = all clean install + +.SUFFIXES: +.SUFFIXES: .cpp .c .o + +.cpp.o: + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< + +.c.o: + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< + +%.h %.cpp: %.ice + rm -f $(*F).h $(*F).cpp + $(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice + +all:: $(SRCS) $(TARGETS) + +clean:: + -rm -f $(TARGETS) + -rm -f core *.o *.bak + +depend:: $(SRCS) $(SLICE_SRCS) + -rm -f .depend + if test -n "$(SRCS)" ; then \ + $(CXX) -DMAKEDEPEND -M $(CXXFLAGS) $(CPPFLAGS) $(SRCS) | $(ice_dir)/config/makedepend.py >> .depend; \ + fi + +ifneq ($(SLICE_SRCS),) +clean:: + rm -f $(addsuffix .cpp, $(basename $(notdir $(SLICE_SRCS)))) + rm -f $(addsuffix .h, $(basename $(notdir $(SLICE_SRCS)))) +endif + +ifneq ($(TEMPLATE_REPOSITORY),) +clean:: + rm -fr $(TEMPLATE_REPOSITORY) +endif + +install:: diff --git a/protobuf/config/Make.rules.mak b/protobuf/config/Make.rules.mak new file mode 100644 index 00000000000..fc93943a2bf --- /dev/null +++ b/protobuf/config/Make.rules.mak @@ -0,0 +1,111 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# Define OPTIMIZE as yes if you want to build with optimization. +# Otherwise the Ice extension is built with debug information. +# + +#OPTIMIZE = yes + +# +# Specify your C++ compiler. Supported values are: +# VC80, VC90 +# +!if "$(CPP_COMPILER)" == "" +CPP_COMPILER = VC80 +!endif + +# +# If Ice is not installed in a standard location, set ICE_HOME to the +# Ice installation directory. +# +#ICE_HOME = C:\Ice-3.3.0-VC90 + +# ---------------------------------------------------------------------- +# Don't change anything below this line! +# ---------------------------------------------------------------------- + +# +# Common definitions +# +ice_language = cpp +ice_require_cpp = yes +slice_translator = slice2cpp.exe + +!if exist ($(top_srcdir)\..\config\Make.common.rules.mak) +!include $(top_srcdir)\..\config\Make.common.rules.mak +!else +!include $(top_srcdir)\config\Make.common.rules.mak +!endif + +# +# Platform specific definitions +# +!if exist ($(top_srcdir)\..\config\Make.common.rules.mak) +!include $(top_srcdir)\..\cpp\config\Make.rules.msvc +!else +!include $(top_srcdir)\config\Make.rules.msvc +!endif + +MT = mt.exe + +!if "$(OPTIMIZE)" != "yes" +LIBSUFFIX = $(LIBSUFFIX)d +!endif + +ICE_LIBS = ice$(LIBSUFFIX).lib iceutil$(LIBSUFFIX).lib + +!if "$(ice_src_dist)" != "" +ICE_CPPFLAGS = -I"$(ice_cpp_dir)\include" +!if "$(ice_cpp_dir)" == "$(ice_dir)\cpp" +ICE_LDFLAGS = /LIBPATH:"$(ice_cpp_dir)\lib" +!else +ICE_LDFLAGS = /LIBPATH:"$(ice_cpp_dir)\lib$(x64suffix)" +!endif +!else +ICE_CPPFLAGS = -I"$(ice_dir)\include" +ICE_LDFLAGS = /LIBPATH:"$(ice_dir)\lib$(x64suffix)" +!endif + +ICECPPFLAGS = -I"$(slicedir)" +SLICE2CPPFLAGS = $(ICECPPFLAGS) + +!if "$(ice_src_dist)" != "" +!if "$(ice_cpp_dir)" == "$(ice_dir)\cpp" +SLICE2CPP = "$(ice_cpp_dir)\bin\slice2cpp.exe" +!else +SLICE2CPP = "$(ice_cpp_dir)\bin$(x64suffix)\slice2cpp.exe" +!endif +!else +SLICE2CPP = "$(ice_dir)\bin$(x64suffix)\slice2cpp.exe" +!endif + +EVERYTHING = all clean install + +.SUFFIXES: +.SUFFIXES: .ice .cpp .obj + +all:: $(SRCS) + +.cpp.obj:: + $(CXX) /c $(CPPFLAGS) $(CXXFLAGS) $< + +.ice.cpp: + del /q $(*F).h $(*F).cpp + $(SLICE2CPP) $(SLICE2CPPFLAGS) $< + +clean:: + -del /q $(TARGETS) + -del /q *.obj *.bak *.ilk *.exp *.pdb *.tds *.idb + +all:: $(SRCS) $(TARGETS) + + diff --git a/protobuf/config/common.xml b/protobuf/config/common.xml new file mode 100644 index 00000000000..03bd41c815a --- /dev/null +++ b/protobuf/config/common.xml @@ -0,0 +1,578 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. + + This copy of Ice is licensed to you under the terms described in the + ICE_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="common" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant"> + + <property environment="env"/> + <property name="build.sysclasspath" value="last"/> + + <target name="init" depends="config-init, task-init"> + <!-- Create the time stamp --> + <tstamp/> + </target> + + <!-- Load build configuration properties --> + <property file="${top.dir}/config/build.properties"/> + + <condition property="thirdparty.home" value="${env.THIRDPARTY_HOME}"> + <and> + <os family="Windows"/> + <isset property="env.THIRDPARTY_HOME"/> + <not><isset property="thirdparty.home"/></not> + </and> + </condition> + + <condition property="thirdparty.home" value="${env.ProgramFiles(x86)}\ZeroC\Ice-${ice.version}-ThirdParty"> + <and> + <os family="Windows"/> + <not><isset property="thirdparty.home"/></not> + <or> + <equals arg1="AMD64" arg2="${env.PROCESSOR_ARCHITECTURE}"/> + <equals arg1="AMD64" arg2="${env.PROCESSOR_ARCHITEW6432}"/> + </or> + </and> + </condition> + + <condition property="thirdparty.home" value="${env.ProgramFiles}\ZeroC\Ice-${ice.version}-ThirdParty"> + <and> + <os family="Windows"/> + <not><isset property="thirdparty.home"/></not> + </and> + </condition> + + + <!-- Set default prefix directory, just if prefix is not set --> + <condition property="prefix" value="${env.SystemDrive}\Ice-${ice.version}"> + <and> + <os family="windows"/> + <not><isset property="prefix"/></not> + </and> + </condition> + + <condition property="prefix" value="/opt/Ice-${ice.version}"> + <and> + <not><os family="windows"/></not> + <not><isset property="prefix"/></not> + </and> + </condition> + + <!-- Use -Xlint when requested --> + <condition property="javac.lint" value="-Xlint:${lint}" else="-Xlint:none"> + <isset property="lint"/> + </condition> + + <!-- Default build suffix is empty. This can be defined by build + scripts to build the jars and classes file in other + directories than the default one. This is useful to build + both the Java2 and Java5 mapping with the same source tree. + --> + <property name="build.suffix" value=""/> + + <!-- Commonly needed properties --> + <property name="class.dir" value="classes${build.suffix}"/> + <property name="generated.dir" value="generated${build.suffix}"/> + + <!-- Do we build the IceGrid Admin graphical tool --> + <!-- Currently we build it when the JDK is version 7 and we are not + on Solaris (which does not have JavaFX) --> + <condition property="build-icegridadmin"> + <and> + <equals arg1="${java.specification.version}" arg2="1.7"/> + <not><os name="SunOS"/></not> + </and> + </condition> + + <!-- We use pathconvert to ensure that ice.top.dir is relative to the path of the build.xml + file insead of the current working directory. --> + <pathconvert property="ice.top.dir"> + <path location="${top.dir}"/> + </pathconvert> + + <!-- Define text.extension to '.txt' in Windows source distributions --> + <condition property="text.extension" value=".txt" else=""> + <and> + <os family="Windows"/> + <available file="${top.dir}/../LICENSE.txt"/> + <not><isset property="text.extension"/></not> + </and> + </condition> + + <condition property="slice.translator" value="slice2java.exe" else="slice2java"> + <os family="windows"/> + </condition> + + <fail message="Unable to find ${slice.translator} in ${ice.home}, please verify ice.home is properly configured and Ice is correctly installed."> + <condition> + <and> + <isset property="ice.home"/> + <not><available file="${ice.home}/bin/${slice.translator}"/></not> + </and> + </condition> + </fail> + <fail message="Unable to find ${slice.translator} in ${env.ICE_HOME}, please verify ICE_HOME is properly configured and Ice is correctly installed."> + <condition> + <and> + <not><isset property="ice.home"/></not> + <isset property="env.ICE_HOME"/> + <not><available file="${env.ICE_HOME}/bin/${slice.translator}"/></not> + </and> + </condition> + </fail> + + <condition property="ice.bin.dist"> + <or> + <equals arg1="${use.bin.dist}" arg2="yes"/> + <equals arg1="${env.USE_BIN_DIST}" arg2="yes"/> + </or> + </condition> + + <!-- First, check if we're building a source distribution. --> + + <condition property="ice.dir" value="${ice.top.dir}/.."> + <and> + <!-- Don't just look for ${ice.top.dir}/../java - we want to make sure we are really + in a source distribution. --> + <available file="${ice.top.dir}/../java/src/Ice/Util.java"/> + <not><isset property="ice.bin.dist"/></not> + </and> + </condition> + <condition property="ice.dir" value="${ice.top.dir}/ice"> + <and> + <!-- Don't just look for ${ice.top.dir}/ice/java - we want to make sure we are really + in a source distribution. --> + <not><isset property="ice.dir"/></not> + <available file="${ice.top.dir}/ice/java/src/Ice/Util.java"/> + <not><isset property="ice.bin.dist"/></not> + </and> + </condition> + <!-- When building a source distribution, we allow using either the + translators from a binary distribution or the local translators, --> + <condition property="ice.cpp.dir" value="${ice.home}"> + <and> + <isset property="ice.dir"/> + <not><isset property="ice.cpp.dir"/></not> + <available file="${ice.home}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.cpp.dir" value="${env.ICE_HOME}" else="${ice.dir}/cpp"> + <and> + <isset property="ice.dir"/> + <not><isset property="ice.cpp.dir"/></not> + <available file="${env.ICE_HOME}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.warn.duplicate.translator"> + <and> + <isset property="ice.cpp.dir"/> + <not><equals arg1="${ice.cpp.dir}" arg2="${ice.dir}/cpp"/></not> + <available file="${ice.dir}/cpp/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.src.dist"> + <and> + <isset property="ice.dir"/> + </and> + </condition> + + <!-- Then, check if we're building against a binary distribution. --> + + <condition property="ice.dir" value="${ice.home}"> + <and> + <not><isset property="ice.dir"/></not> + <isset property="ice.home"/> + </and> + </condition> + <condition property="ice.dir" value="${env.ICE_HOME}"> + <and> + <not><isset property="ice.dir"/></not> + <isset property="env.ICE_HOME"/> + </and> + </condition> + <condition property="ice.dir" value="${ice.top.dir}"> + <and> + <not><isset property="ice.dir"/></not> + <available file="${ice.top.dir}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.dir" value="/usr"> + <and> + <not><isset property="ice.dir"/></not> + <available file="/usr/bin/${slice.translator}"/> + </and> + </condition> + + <condition property="ice.dir" value="${env.ProgramFiles(x86)}\ZeroC\Ice-${ice.version}"> + <and> + <os family="Windows"/> + <not><isset property="ice.dir"/></not> + <or> + <and> + <or> + <equals arg1="AMD64" arg2="${env.PROCESSOR_ARCHITECTURE}"/> + <equals arg1="IA64" arg2="${env.PROCESSOR_ARCHITECTURE}"/> + </or> + </and> + <and> + <or> + <equals arg1="AMD64" arg2="${env.PROCESSOR_ARCHITEW6432}"/> + <equals arg1="IA64" arg2="${env.PROCESSOR_ARCHITEW6432}"/> + </or> + </and> + </or> + </and> + </condition> + + <condition property="ice.dir" value="${env.ProgramFiles}\ZeroC\Ice-${ice.version}"> + <and> + <os family="windows"/> + <not><isset property="ice.dir"/></not> + </and> + </condition> + <condition property="ice.dir" value="/Library/Developer/Ice-${ice.version}"> + <and> + <os family="mac"/> + <not><isset property="ice.dir"/></not> + <available file="/Library/Developer/Ice-${ice.version}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.dir" value="/opt/Ice-${ice.version}"> + <and> + <not><os family="windows"/></not> + <not><isset property="ice.dir"/></not> + <available file="/opt/Ice-${ice.version}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.bin.dist"> + <and> + <not><isset property="ice.src.dist"/></not> + <isset property="ice.dir"/> + </and> + </condition> + <fail message="Unable to find a valid Ice distribution, please verify ICE_HOME is properly configured and Ice is correctly installed."> + <condition> + <not><or> + <isset property="ice.src.dist"/> + <isset property="ice.bin.dist"/> + </or></not> + </condition> + </fail> + + <!-- Set ice.home for the ant Slice tasks or ensure it's properly set by the user. --> + <condition property="ice.home" value="${ice.dir}"> + <isset property="ice.bin.dist"/> + </condition> + <condition property="ice.home" value="${ice.cpp.dir}"> + <isset property="ice.src.dist"/> + </condition> + + <!-- Set db.jar.file to the path name of the Berkeley DB JAR file, but only if it's + not already present in the class path. --> + <condition property="db.jar.file" value="/usr/share/java/db-${db.version}.jar"> + <and> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/usr/share/java/db-${db.version}.jar"/> + </and> + </condition> + <condition property="db.jar.file" value="/opt/Ice-${ice.version}/lib/db.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/opt/Ice-${ice.version}/lib/db.jar"/> + </and> + </condition> + <condition property="db.jar.file" value="/opt/db-${db.version}/lib/db.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/opt/db-${db.version}/lib/db.jar"/> + </and> + </condition> + <condition property="db.jar.file" value="/opt/db/lib/db.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/opt/db/lib/db.jar"/> + </and> + </condition> + <condition property="db.jar.file" value="/usr/lib/db.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/usr/lib/db.jar"/> + </and> + </condition> + + + <condition property="db.jar.file" value="${thirdparty.home}/lib/db.jar"> + <and> + <os family="windows"/> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="${thirdparty.home}/lib/db.jar"/> + </and> + </condition> + + + <path id="db.classpath"> + <pathelement location="${db.jar.file}"/> + </path> + + <!-- Set jgoodies.common to the path name of the Jgoodies Common JAR file --> + <condition property="jgoodies.common" value="/usr/share/java/jgoodies-common-${jgoodies-common.version}.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="jgoodies.common"/></not> + <not><available classname="com.jgoodies.common.base.SystemUtils"/></not> + <available file="/usr/share/java/jgoodies-common-${jgoodies-common.version}.jar"/> + </and> + </condition> + <condition property="jgoodies.common" + value="${thirdparty.home}/lib/jgoodies-common-${jgoodies-common.version}.jar"> + <and> + <os family="windows"/> + <not><isset property="jgoodies.common"/></not> + <not><available classname="com.jgoodies.common.base.SystemUtils"/></not> + <available file="${thirdparty.home}/lib/jgoodies-common-${jgoodies-common.version}.jar"/> + </and> + </condition> + + <!-- Set jgoodies.forms to the path name of the Jgoodies Forms JAR file --> + <condition property="jgoodies.forms" value="/usr/share/java/jgoodies-forms-${jgoodies-forms.version}.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="jgoodies.forms"/></not> + <not><available classname="com.jgoodies.forms.builder.DefaultFormBuilder"/></not> + <available file="/usr/share/java/jgoodies-forms-${jgoodies-forms.version}.jar"/> + </and> + </condition> + <condition property="jgoodies.forms" + value="${thirdparty.home}/lib/jgoodies-forms-${jgoodies-forms.version}.jar"> + <and> + <os family="windows"/> + <not><isset property="jgoodies.forms"/></not> + <not><available classname="com.jgoodies.forms.builder.DefaultFormBuilder"/></not> + <available file="${thirdparty.home}/lib/jgoodies-forms-${jgoodies-forms.version}.jar"/> + </and> + </condition> + + <!-- Set jgoodies.looks to the path name of the Jgoodies Looks JAR file --> + <condition property="jgoodies.looks" value="/usr/share/java/jgoodies-looks-${jgoodies-looks.version}.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="jgoodies.looks"/></not> + <not><available classname="com.jgoodies.looks.Options"/></not> + <available file="/usr/share/java/jgoodies-looks-${jgoodies-looks.version}.jar"/> + </and> + </condition> + <condition property="jgoodies.looks" + value="${thirdparty.home}/lib/jgoodies-looks-${jgoodies-looks.version}.jar"> + <and> + <os family="windows"/> + <not><isset property="jgoodies.looks"/></not> + <not><available classname="com.jgoodies.looks.Options"/></not> + <available file="${thirdparty.home}/lib/jgoodies-looks-${jgoodies-looks.version}.jar"/> + </and> + </condition> + + <target name="config-init-warn" if="ice.warn.duplicate.translator"> + <echo message="Found ${slice.translator} in both ${ice.cpp.dir}/bin and ${ice.dir}/cpp/bin, ${ice.cpp.dir}/bin/${slice.translator} will be used!" level="warning"/> + </target> + + <target name="config-init-javafx" if="build-icegridadmin"> + + <!-- JavaFX jar file --> + <condition property="javafx.jar" value="${java.home}/lib/jfxrt.jar"> + <and> + <not><isset property="javafx.jar"/></not> + <available file="${java.home}/lib/jfxrt.jar"/> + </and> + </condition> + + <condition property="ant-javafx.jar" value="${java.home}/../lib/ant-javafx.jar"> + <and> + <not><isset property="ant-javafx.jar"/></not> + <available file="${java.home}/../lib/ant-javafx.jar"/> + </and> + </condition> + + <taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" + classpath="${ant-javafx.jar}"/> + </target> + + <target name="config-init" depends="config-init-warn"> + + <!-- Set slice.dir to the directory containing the Slice files. --> + <condition property="slice.dir" value="/usr/share/Ice-${ice.version}/slice" else="${ice.dir}/slice"> + <equals arg1="${ice.dir}" arg2="/usr"/> + </condition> + + <!-- Set ice.classpath with the distribution Ice.jar file --> + <condition property="dist.lib.dir" value="${ice.dir}/java/lib${build.suffix}"> + <isset property="ice.src.dist"/> + </condition> + <condition property="dist.lib.dir" value="${ice.dir}/lib"> + <and> + <isset property="ice.bin.dist"/> + <not><equals arg1="${ice.dir}" arg2="/usr"/></not> + </and> + </condition> + <condition property="dist.lib.dir" value="/usr/share/java"> + <and> + <isset property="ice.bin.dist"/> + <equals arg1="${ice.dir}" arg2="/usr"/> + </and> + </condition> + + <!-- Ice jar file --> + <condition property="ice.jar.file" value="${dist.lib.dir}/Ice-${ice.version}.jar"> + <and> + <not><isset property="ice.jar.file"/></not> + <available file="${dist.lib.dir}/Ice-${ice.version}.jar"/> + </and> + </condition> + + <condition property="ice.jar.file" value="${dist.lib.dir}/Ice.jar"> + <and> + <not><isset property="ice.jar.file"/></not> + <available file="${dist.lib.dir}/Ice.jar"/> + </and> + </condition> + + <path id="ice.classpath"> + <pathelement location="${ice.jar.file}"/> + </path> + + <!-- Glacier2 jar file --> + <condition property="glacier2.jar.file" value="${dist.lib.dir}/Glacier2-${ice.version}.jar"> + <and> + <not><isset property="glacier2.jar.file"/></not> + <available file="${dist.lib.dir}/Glacier2-${ice.version}.jar"/> + </and> + </condition> + + <condition property="glacier2.jar.file" value="${dist.lib.dir}/Glacier2.jar"> + <and> + <not><isset property="glacier2.jar.file"/></not> + <available file="${dist.lib.dir}/Glacier2.jar"/> + </and> + </condition> + + <path id="glacier2.classpath"> + <pathelement location="${glacier2.jar.file}"/> + </path> + + <!-- Set freeze.classpath with the distribution Freeze.jar file --> + <condition property="freeze.jar.file" value="${dist.lib.dir}/Freeze-${ice.version}.jar"> + <and> + <not><isset property="freeze.jar.file"/></not> + <available file="${dist.lib.dir}/Freeze-${ice.version}.jar"/> + </and> + </condition> + + <condition property="freeze.jar.file" value="${dist.lib.dir}/Freeze.jar"> + <and> + <not><isset property="freeze.jar.file"/></not> + <available file="${dist.lib.dir}/Freeze.jar"/> + </and> + </condition> + + <path id="freeze.classpath"> + <pathelement location="${freeze.jar.file}"/> + <path refid="db.classpath"/> + </path> + + + <!-- IceBox jar file --> + <condition property="icebox.jar.file" value="${dist.lib.dir}/IceBox-${ice.version}.jar"> + <and> + <not><isset property="icebox.jar.file"/></not> + <available file="${dist.lib.dir}/IceBox-${ice.version}.jar"/> + </and> + </condition> + + <condition property="icebox.jar.file" value="${dist.lib.dir}/IceBox.jar"> + <and> + <not><isset property="icebox.jar.file"/></not> + <available file="${dist.lib.dir}/IceBox.jar"/> + </and> + </condition> + + <path id="icebox.classpath"> + <pathelement location="${icebox.jar.file}"/> + </path> + + <!-- IceStorm jar file --> + <condition property="icestorm.jar.file" value="${dist.lib.dir}/IceStorm-${ice.version}.jar"> + <and> + <not><isset property="icestorm.jar.file"/></not> + <available file="${dist.lib.dir}/IceStorm-${ice.version}.jar"/> + </and> + </condition> + + <condition property="icestorm.jar.file" value="${dist.lib.dir}/IceStorm.jar"> + <and> + <not><isset property="icestorm.jar.file"/></not> + <available file="${dist.lib.dir}/IceStorm.jar"/> + </and> + </condition> + + <path id="icestorm.classpath"> + <pathelement location="${icestorm.jar.file}"/> + </path> + + <!-- IceGrid jar file --> + <condition property="icegrid.jar.file" value="${dist.lib.dir}/IceGrid-${ice.version}.jar"> + <and> + <not><isset property="icegrid.jar.file"/></not> + <available file="${dist.lib.dir}/IceGrid-${ice.version}.jar"/> + </and> + </condition> + + <condition property="icegrid.jar.file" value="${dist.lib.dir}/IceGrid.jar"> + <and> + <not><isset property="icegrid.jar.file"/></not> + <available file="${dist.lib.dir}/IceGrid.jar"/> + </and> + </condition> + + <path id="icegrid.classpath"> + <pathelement location="${icegrid.jar.file}"/> + </path> + + <condition property="certs.dir" value="${ice.top.dir}/certs" else="${ice.top.dir}/../certs"> + <available file="${ice.top.dir}/certs/client.jks"/> + </condition> + </target> + + <!-- Install the Slice ant tasks. --> + <target name="task-init"> + + <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice-${ice.version}.jar"> + <available file="${dist.lib.dir}/ant-ice-${ice.version}.jar"/> + </condition> + + <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice.jar"> + <and> + <not><isset property="task.jar.file"/></not> + <available file="${dist.lib.dir}/ant-ice.jar"/> + </and> + </condition> + + <taskdef name="slice2java" classpath="${task.jar.file}" classname="Slice2JavaTask"/> + <taskdef name="slice2freezej" classpath="${task.jar.file}" classname="Slice2FreezeJTask" /> + + </target> + +</project> diff --git a/protobuf/config/common.xml.orig b/protobuf/config/common.xml.orig new file mode 100644 index 00000000000..37c7f28b783 --- /dev/null +++ b/protobuf/config/common.xml.orig @@ -0,0 +1,304 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. + + This copy of Ice Protobuf is licensed to you under the terms described + in the ICE_PROTOBUF_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="common" basedir="."> + + <property environment="env"/> + + <target name="init" depends="config-init, task-init"> + <!-- Create the time stamp --> + <tstamp/> + </target> + + <!-- Load build configuration properties --> + <property file="${top.dir}/config/build.properties"/> + + <!-- Check which Ice language mapping we're supposed to build, "java2" or "java5" --> + <condition property="ice.mapping" value="java5"> + <not><isset property="ice.mapping"/></not> + </condition> + <fail message="Invalid ${ice.mapping} value specified in build.properties."> + <condition> + <and> + <not><equals arg1="${ice.mapping}" arg2="java2" trim="true"/></not> + <not><equals arg1="${ice.mapping}" arg2="java5" trim="true"/></not> + </and> + </condition> + </fail> + <condition property="java2"> + <equals arg1="${ice.mapping}" arg2="java2"/> + </condition> + + <!-- Use the global metadata "java:java2" when using java2 mapping --> + <condition property="java2metadata" value="java:java2" else=""> + <isset property="java2"/> + </condition> + + <!-- Use -Xlint when requested --> + <condition property="javac.lint" value="-Xlint:${lint}" else="-Xlint:none"> + <isset property="lint"/> + </condition> + + <!-- Default build suffix is empty. This can be defined by build + scripts to build the jars and classes file in other + directories than the default one. This is useful to build + both the Java2 and Java5 mapping with the same source tree. + --> + <property name="build.suffix" value=""/> + + <!-- Commonly needed properties --> + <property name="class.dir" value="classes${build.suffix}"/> + <property name="generated.dir" value="generated${build.suffix}"/> + + <!-- We use pathconvert to ensure that ice.top.dir is relative to the path of the build.xml + file insead of the current working directory. --> + <pathconvert property="ice.top.dir"> + <path location="${top.dir}"/> + </pathconvert> + + <condition property="slice.translator" value="slice2java.exe" else="slice2java"> + <os family="windows"/> + </condition> + + <fail message="Unable to find ${slice.translator} in ${ice.home}, please verify ice.home is properly configured and Ice is correctly installed."> + <condition> + <and> + <isset property="ice.home"/> + <not><available file="${ice.home}/bin/${slice.translator}"/></not> + </and> + </condition> + </fail> + <fail message="Unable to find ${slice.translator} in ${env.ICE_HOME}, please verify ICE_HOME is properly configured and Ice is correctly installed."> + <condition> + <and> + <not><isset property="ice.home"/></not> + <isset property="env.ICE_HOME"/> + <not><available file="${env.ICE_HOME}/bin/${slice.translator}"/></not> + </and> + </condition> + </fail> + + <condition property="ice.bin.dist"> + <or> + <equals arg1="${use.bin.dist}" arg2="yes"/> + <equals arg1="${env.USE_BIN_DIST}" arg2="yes"/> + </or> + </condition> + + <!-- First, check if we're building a source distribution. --> + + <condition property="ice.dir" value="${ice.top.dir}/.."> + <and> + <!-- Don't just look for ${ice.top.dir}/../java - we want to make sure we are really + in a source distribution. --> + <available file="${ice.top.dir}/../java/src/Ice/Util.java"/> + <not><isset property="ice.bin.dist"/></not> + </and> + </condition> + <!-- When building a source distribution, we allow using either the + translators from a binary distribution or the local translators, --> + <condition property="ice.cpp.dir" value="${ice.home}"> + <and> + <isset property="ice.dir"/> + <not><isset property="ice.cpp.dir"/></not> + <available file="${ice.home}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.cpp.dir" value="${env.ICE_HOME}" else="${ice.dir}/cpp"> + <and> + <isset property="ice.dir"/> + <not><isset property="ice.cpp.dir"/></not> + <available file="${env.ICE_HOME}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.warn.duplicate.translator"> + <and> + <isset property="ice.cpp.dir"/> + <not><equals arg1="${ice.cpp.dir}" arg2="${ice.dir}/cpp"/></not> + <available file="${ice.dir}/cpp/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.src.dist"> + <and> + <isset property="ice.dir"/> + </and> + </condition> + + <!-- Then, check if we're building against a binary distribution. --> + + <condition property="ice.dir" value="${ice.home}"> + <and> + <not><isset property="ice.dir"/></not> + <isset property="ice.home"/> + </and> + </condition> + <condition property="ice.dir" value="${env.ICE_HOME}"> + <and> + <not><isset property="ice.dir"/></not> + <isset property="env.ICE_HOME"/> + </and> + </condition> + <condition property="ice.dir" value="${ice.top.dir}"> + <and> + <not><isset property="ice.dir"/></not> + <available file="${ice.top.dir}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.dir" value="/usr"> + <and> + <not><isset property="ice.dir"/></not> + <available file="/usr/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.dir" value="C:\Ice-${ice.version}"> + <and> + <os family="windows"/> + <not><isset property="ice.dir"/></not> + <available file="C:\Ice-${ice.version}\bin\${slice.translator}"/> + </and> + </condition> + <condition property="ice.dir" value="/opt/Ice-${ice.version}"> + <and> + <not><os family="windows"/></not> + <not><isset property="ice.dir"/></not> + <available file="/opt/Ice-${ice.version}/bin/${slice.translator}"/> + </and> + </condition> + <condition property="ice.bin.dist"> + <and> + <not><isset property="ice.src.dist"/></not> + <isset property="ice.dir"/> + </and> + </condition> + <fail message="Unable to find a valid Ice distribution, please verify ICE_HOME is properly configured and Ice is correctly installed."> + <condition> + <not><or> + <isset property="ice.src.dist"/> + <isset property="ice.bin.dist"/> + </or></not> + </condition> + </fail> + + <!-- Set ice.home for the ant Slice tasks or ensure it's properly set by the user. --> + <condition property="ice.home" value="${ice.dir}"> + <isset property="ice.bin.dist"/> + </condition> + <condition property="ice.home" value="${ice.cpp.dir}"> + <isset property="ice.src.dist"/> + </condition> + + <!-- Set db.jar.file to the path name of the Berkeley DB JAR file, but only if it's + not already present in the class path. --> + <condition property="db.jar.file" value="/usr/share/java/db-${db.version}.jar"> + <and> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/usr/share/java/db-${db.version}.jar"/> + </and> + </condition> + <condition property="db.jar.file" value="/opt/Ice-${ice.version}/lib/db.jar"> + <and> + <not><os family="windows"/></not> + <not><isset property="db.jar.file"/></not> + <not><available classname="com.sleepycat.db.Database"/></not> + <available file="/opt/Ice-${ice.version}/lib/db.jar"/> + </and> + </condition> + + <path id="db.classpath"> + <pathelement path="${db.jar.file}"/> + </path> + + <target name="config-init-warn" if="ice.warn.duplicate.translator"> + <echo message="Found ${slice.translator} in both ${ice.cpp.dir}/bin and ${ice.dir}/cpp/bin, ${ice.cpp.dir}/bin/${slice.translator} will be used!" level="warning"/> + </target> + + <target name="config-init" depends="config-init-warn"> + + <!-- Set slice.dir to the directory containing the Slice files. --> + <condition property="slice.dir" value="/usr/share/Ice-${ice.version}/slice" else="${ice.dir}/slice"> + <equals arg1="${ice.dir}" arg2="/usr"/> + </condition> + + <!-- Set ice.classpath with the distribution Ice.jar file --> + <condition property="dist.lib.dir" value="${ice.dir}/java/lib${build.suffix}"> + <isset property="ice.src.dist"/> + </condition> + <condition property="dist.lib.dir" value="${ice.dir}/lib"> + <and> + <isset property="ice.bin.dist"/> + <not><equals arg1="${ice.dir}" arg2="/usr"/></not> + </and> + </condition> + <condition property="dist.lib.dir" value="/usr/share/java"> + <and> + <isset property="ice.bin.dist"/> + <equals arg1="${ice.dir}" arg2="/usr"/> + </and> + </condition> + + <condition property="dist.jar.file" value="${dist.lib.dir}/Ice-java2-${ice.version}.jar"> + <and> + <available file="${dist.lib.dir}/Ice-java2-${ice.version}.jar"/> + <isset property="java2"/> + </and> + </condition> + + <condition property="dist.jar.file" value="${dist.lib.dir}/java2/Ice.jar"> + <and> + <not><isset property="dist.jar.file"/></not> + <available file="${dist.lib.dir}/java2/Ice.jar"/> + <isset property="java2"/> + </and> + </condition> + + <condition property="dist.jar.file" value="${dist.lib.dir}/Ice-${ice.version}.jar"> + <and> + <not><isset property="dist.jar.file"/></not> + <available file="${dist.lib.dir}/Ice-${ice.version}.jar"/> + </and> + </condition> + + <condition property="dist.jar.file" value="${dist.lib.dir}/Ice.jar"> + <and> + <not><isset property="dist.jar.file"/></not> + <available file="${dist.lib.dir}/Ice.jar"/> + </and> + </condition> + + <path id="ice.classpath"> + <fileset file="${dist.jar.file}"/> + </path> + + <condition property="certs.dir" value="${ice.top.dir}/certs" else="${ice.top.dir}/../certs"> + <available file="${ice.top.dir}/certs/client.jks"/> + </condition> + </target> + + <!-- Install the Slice ant tasks. --> + <target name="task-init"> + + <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice-${ice.version}.jar"> + <available file="${dist.lib.dir}/ant-ice-${ice.version}.jar"/> + </condition> + + <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice.jar"> + <and> + <not><isset property="task.jar.file"/></not> + <available file="${dist.lib.dir}/ant-ice.jar"/> + </and> + </condition> + + <taskdef name="slice2java" classpath="${task.jar.file}" classname="Slice2JavaTask"/> + <taskdef name="slice2freezej" classpath="${task.jar.file}" classname="Slice2FreezeJTask" /> + + </target> + +</project> diff --git a/protobuf/demo/cpp/.depend b/protobuf/demo/cpp/.depend new file mode 100644 index 00000000000..959fff0cb91 --- /dev/null +++ b/protobuf/demo/cpp/.depend @@ -0,0 +1,6 @@ +Hello$(OBJEXT): Hello.cpp Hello.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/Direct.h Person.pb.h StreamProtobuf.h $(ice_cpp_dir)/include/Ice/Ice.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Ice/LoggerUtil.h $(ice_cpp_dir)/include/Ice/Stats.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/CommunicatorAsync.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/Ice/ObjectAdapter.h $(ice_cpp_dir)/include/Ice/FacetMap.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/ServantLocator.h $(ice_cpp_dir)/include/Ice/SlicedData.h $(ice_cpp_dir)/include/Ice/Process.h $(ice_cpp_dir)/include/Ice/Application.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ConnectionAsync.h $(ice_cpp_dir)/include/Ice/Functional.h $(ice_cpp_dir)/include/IceUtil/Functional.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h $(ice_cpp_dir)/include/Ice/DispatchInterceptor.h $(ice_cpp_dir)/include/Ice/PropertiesAdmin.h $(ice_cpp_dir)/include/Ice/Metrics.h $(ice_cpp_dir)/include/Ice/Service.h $(ice_cpp_dir)/include/Ice/IconvStringConverter.h +Person.pb$(OBJEXT): Person.pb.cpp Person.pb.h +Client$(OBJEXT): Client.cpp $(ice_cpp_dir)/include/Ice/Ice.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Ice/LoggerUtil.h $(ice_cpp_dir)/include/Ice/Stats.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/CommunicatorAsync.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/Ice/ObjectAdapter.h $(ice_cpp_dir)/include/Ice/FacetMap.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/ServantLocator.h $(ice_cpp_dir)/include/Ice/SlicedData.h $(ice_cpp_dir)/include/Ice/Process.h $(ice_cpp_dir)/include/Ice/Application.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ConnectionAsync.h $(ice_cpp_dir)/include/Ice/Functional.h $(ice_cpp_dir)/include/IceUtil/Functional.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h $(ice_cpp_dir)/include/Ice/DispatchInterceptor.h $(ice_cpp_dir)/include/Ice/PropertiesAdmin.h $(ice_cpp_dir)/include/Ice/Metrics.h $(ice_cpp_dir)/include/Ice/Service.h $(ice_cpp_dir)/include/Ice/IconvStringConverter.h Hello.h Person.pb.h StreamProtobuf.h +HelloI$(OBJEXT): HelloI.cpp $(ice_cpp_dir)/include/IceUtil/IceUtil.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/IceUtil/AbstractMutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/Cache.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/IceUtil/CountDownLatch.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/CtrlCHandler.h $(ice_cpp_dir)/include/IceUtil/Functional.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/MutexPtrLock.h $(ice_cpp_dir)/include/IceUtil/RecMutex.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/UUID.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/Ice.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Ice/LoggerUtil.h $(ice_cpp_dir)/include/Ice/Stats.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/CommunicatorAsync.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/Ice/ObjectAdapter.h $(ice_cpp_dir)/include/Ice/FacetMap.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/ServantLocator.h $(ice_cpp_dir)/include/Ice/SlicedData.h $(ice_cpp_dir)/include/Ice/Process.h $(ice_cpp_dir)/include/Ice/Application.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ConnectionAsync.h $(ice_cpp_dir)/include/Ice/Functional.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h $(ice_cpp_dir)/include/Ice/DispatchInterceptor.h $(ice_cpp_dir)/include/Ice/PropertiesAdmin.h $(ice_cpp_dir)/include/Ice/Metrics.h $(ice_cpp_dir)/include/Ice/Service.h $(ice_cpp_dir)/include/Ice/IconvStringConverter.h HelloI.h Hello.h Person.pb.h StreamProtobuf.h +Server$(OBJEXT): Server.cpp $(ice_cpp_dir)/include/Ice/Ice.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Ice/LoggerUtil.h $(ice_cpp_dir)/include/Ice/Stats.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/CommunicatorAsync.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/Ice/ObjectAdapter.h $(ice_cpp_dir)/include/Ice/FacetMap.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/ServantLocator.h $(ice_cpp_dir)/include/Ice/SlicedData.h $(ice_cpp_dir)/include/Ice/Process.h $(ice_cpp_dir)/include/Ice/Application.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ConnectionAsync.h $(ice_cpp_dir)/include/Ice/Functional.h $(ice_cpp_dir)/include/IceUtil/Functional.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h $(ice_cpp_dir)/include/Ice/DispatchInterceptor.h $(ice_cpp_dir)/include/Ice/PropertiesAdmin.h $(ice_cpp_dir)/include/Ice/Metrics.h $(ice_cpp_dir)/include/Ice/Service.h $(ice_cpp_dir)/include/Ice/IconvStringConverter.h HelloI.h Hello.h Person.pb.h StreamProtobuf.h +Person.pb.cpp: Person.proto diff --git a/protobuf/demo/cpp/.depend.mak b/protobuf/demo/cpp/.depend.mak new file mode 100644 index 00000000000..14bfceaf5c5 --- /dev/null +++ b/protobuf/demo/cpp/.depend.mak @@ -0,0 +1,5 @@ +Hello$(OBJEXT): Hello.cpp Hello.h "$(ice_cpp_dir)/include/Ice/ProxyF.h" "$(ice_cpp_dir)/include/IceUtil/Shared.h" "$(ice_cpp_dir)/include/IceUtil/Config.h" "$(ice_cpp_dir)/include/Ice/Config.h" "$(ice_cpp_dir)/include/Ice/ProxyHandle.h" "$(ice_cpp_dir)/include/IceUtil/Handle.h" "$(ice_cpp_dir)/include/IceUtil/Exception.h" "$(ice_cpp_dir)/include/Ice/ObjectF.h" "$(ice_cpp_dir)/include/Ice/Handle.h" "$(ice_cpp_dir)/include/Ice/Exception.h" "$(ice_cpp_dir)/include/Ice/Format.h" "$(ice_cpp_dir)/include/Ice/StreamF.h" "$(ice_cpp_dir)/include/Ice/LocalObject.h" "$(ice_cpp_dir)/include/Ice/LocalObjectF.h" "$(ice_cpp_dir)/include/Ice/StreamHelpers.h" "$(ice_cpp_dir)/include/IceUtil/ScopedArray.h" "$(ice_cpp_dir)/include/IceUtil/Iterator.h" "$(ice_cpp_dir)/include/Ice/Proxy.h" "$(ice_cpp_dir)/include/IceUtil/Mutex.h" "$(ice_cpp_dir)/include/IceUtil/Lock.h" "$(ice_cpp_dir)/include/IceUtil/ThreadException.h" "$(ice_cpp_dir)/include/IceUtil/Time.h" "$(ice_cpp_dir)/include/IceUtil/MutexProtocol.h" "$(ice_cpp_dir)/include/Ice/ProxyFactoryF.h" "$(ice_cpp_dir)/include/Ice/ConnectionIF.h" "$(ice_cpp_dir)/include/Ice/RequestHandlerF.h" "$(ice_cpp_dir)/include/Ice/EndpointIF.h" "$(ice_cpp_dir)/include/Ice/EndpointF.h" "$(ice_cpp_dir)/include/IceUtil/Optional.h" "$(ice_cpp_dir)/include/Ice/UndefSysMacros.h" "$(ice_cpp_dir)/include/Ice/EndpointTypes.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapterF.h" "$(ice_cpp_dir)/include/Ice/ReferenceF.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsync.h" "$(ice_cpp_dir)/include/IceUtil/Monitor.h" "$(ice_cpp_dir)/include/IceUtil/Cond.h" "$(ice_cpp_dir)/include/IceUtil/Timer.h" "$(ice_cpp_dir)/include/IceUtil/Thread.h" "$(ice_cpp_dir)/include/IceUtil/UniquePtr.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h" "$(ice_cpp_dir)/include/Ice/InstanceF.h" "$(ice_cpp_dir)/include/Ice/CommunicatorF.h" "$(ice_cpp_dir)/include/Ice/Current.h" "$(ice_cpp_dir)/include/Ice/ConnectionF.h" "$(ice_cpp_dir)/include/Ice/Identity.h" "$(ice_cpp_dir)/include/Ice/Version.h" "$(ice_cpp_dir)/include/Ice/BasicStream.h" "$(ice_cpp_dir)/include/Ice/Object.h" "$(ice_cpp_dir)/include/Ice/GCShared.h" "$(ice_cpp_dir)/include/Ice/GCCountMap.h" "$(ice_cpp_dir)/include/Ice/IncomingAsyncF.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryF.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h" "$(ice_cpp_dir)/include/Ice/Buffer.h" "$(ice_cpp_dir)/include/Ice/Protocol.h" "$(ice_cpp_dir)/include/Ice/SlicedDataF.h" "$(ice_cpp_dir)/include/Ice/UserExceptionFactory.h" "$(ice_cpp_dir)/include/Ice/FactoryTable.h" "$(ice_cpp_dir)/include/Ice/ObserverHelper.h" "$(ice_cpp_dir)/include/Ice/Instrumentation.h" "$(ice_cpp_dir)/include/Ice/Outgoing.h" "$(ice_cpp_dir)/include/Ice/Incoming.h" "$(ice_cpp_dir)/include/Ice/ServantLocatorF.h" "$(ice_cpp_dir)/include/Ice/ServantManagerF.h" "$(ice_cpp_dir)/include/Ice/Direct.h" Person.pb.h StreamProtobuf.h "$(ice_cpp_dir)/include/Ice/Ice.h" "$(ice_cpp_dir)/include/Ice/Initialize.h" "$(ice_cpp_dir)/include/Ice/PropertiesF.h" "$(ice_cpp_dir)/include/Ice/LoggerF.h" "$(ice_cpp_dir)/include/Ice/StatsF.h" "$(ice_cpp_dir)/include/Ice/InstrumentationF.h" "$(ice_cpp_dir)/include/Ice/Dispatcher.h" "$(ice_cpp_dir)/include/Ice/StringConverter.h" "$(ice_cpp_dir)/include/Ice/Plugin.h" "$(ice_cpp_dir)/include/Ice/BuiltinSequences.h" "$(ice_cpp_dir)/include/IceUtil/Unicode.h" "$(ice_cpp_dir)/include/Ice/LocalException.h" "$(ice_cpp_dir)/include/Ice/Properties.h" "$(ice_cpp_dir)/include/Ice/IncomingAsync.h" "$(ice_cpp_dir)/include/Ice/Logger.h" "$(ice_cpp_dir)/include/Ice/LoggerUtil.h" "$(ice_cpp_dir)/include/Ice/Stats.h" "$(ice_cpp_dir)/include/Ice/Communicator.h" "$(ice_cpp_dir)/include/Ice/RouterF.h" "$(ice_cpp_dir)/include/Ice/LocatorF.h" "$(ice_cpp_dir)/include/Ice/PluginF.h" "$(ice_cpp_dir)/include/Ice/ImplicitContextF.h" "$(ice_cpp_dir)/include/Ice/CommunicatorAsync.h" "$(ice_cpp_dir)/include/Ice/ObjectFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapter.h" "$(ice_cpp_dir)/include/Ice/FacetMap.h" "$(ice_cpp_dir)/include/Ice/Endpoint.h" "$(ice_cpp_dir)/include/Ice/ServantLocator.h" "$(ice_cpp_dir)/include/Ice/SlicedData.h" "$(ice_cpp_dir)/include/Ice/Process.h" "$(ice_cpp_dir)/include/Ice/Application.h" "$(ice_cpp_dir)/include/Ice/Connection.h" "$(ice_cpp_dir)/include/Ice/ConnectionAsync.h" "$(ice_cpp_dir)/include/Ice/Functional.h" "$(ice_cpp_dir)/include/IceUtil/Functional.h" "$(ice_cpp_dir)/include/Ice/Stream.h" "$(ice_cpp_dir)/include/Ice/ImplicitContext.h" "$(ice_cpp_dir)/include/Ice/Locator.h" "$(ice_cpp_dir)/include/Ice/FactoryTableInit.h" "$(ice_cpp_dir)/include/Ice/ProcessF.h" "$(ice_cpp_dir)/include/Ice/Router.h" "$(ice_cpp_dir)/include/Ice/DispatchInterceptor.h" "$(ice_cpp_dir)/include/Ice/PropertiesAdmin.h" "$(ice_cpp_dir)/include/Ice/Metrics.h" "$(ice_cpp_dir)/include/Ice/Service.h" "$(ice_cpp_dir)/include/Ice/IconvStringConverter.h" +Person.pb$(OBJEXT): Person.pb.cpp Person.pb.h +Client$(OBJEXT): Client.cpp "$(ice_cpp_dir)/include/Ice/Ice.h" "$(ice_cpp_dir)/include/IceUtil/Config.h" "$(ice_cpp_dir)/include/Ice/Initialize.h" "$(ice_cpp_dir)/include/Ice/CommunicatorF.h" "$(ice_cpp_dir)/include/Ice/ProxyF.h" "$(ice_cpp_dir)/include/IceUtil/Shared.h" "$(ice_cpp_dir)/include/Ice/Config.h" "$(ice_cpp_dir)/include/Ice/ProxyHandle.h" "$(ice_cpp_dir)/include/IceUtil/Handle.h" "$(ice_cpp_dir)/include/IceUtil/Exception.h" "$(ice_cpp_dir)/include/Ice/ObjectF.h" "$(ice_cpp_dir)/include/Ice/Handle.h" "$(ice_cpp_dir)/include/Ice/Exception.h" "$(ice_cpp_dir)/include/Ice/Format.h" "$(ice_cpp_dir)/include/Ice/StreamF.h" "$(ice_cpp_dir)/include/Ice/LocalObject.h" "$(ice_cpp_dir)/include/Ice/LocalObjectF.h" "$(ice_cpp_dir)/include/Ice/StreamHelpers.h" "$(ice_cpp_dir)/include/IceUtil/ScopedArray.h" "$(ice_cpp_dir)/include/IceUtil/Iterator.h" "$(ice_cpp_dir)/include/IceUtil/Optional.h" "$(ice_cpp_dir)/include/Ice/UndefSysMacros.h" "$(ice_cpp_dir)/include/Ice/PropertiesF.h" "$(ice_cpp_dir)/include/Ice/InstanceF.h" "$(ice_cpp_dir)/include/Ice/LoggerF.h" "$(ice_cpp_dir)/include/Ice/StatsF.h" "$(ice_cpp_dir)/include/Ice/InstrumentationF.h" "$(ice_cpp_dir)/include/Ice/Dispatcher.h" "$(ice_cpp_dir)/include/Ice/ConnectionF.h" "$(ice_cpp_dir)/include/Ice/StringConverter.h" "$(ice_cpp_dir)/include/Ice/Plugin.h" "$(ice_cpp_dir)/include/Ice/BuiltinSequences.h" "$(ice_cpp_dir)/include/IceUtil/Unicode.h" "$(ice_cpp_dir)/include/Ice/FactoryTable.h" "$(ice_cpp_dir)/include/IceUtil/Mutex.h" "$(ice_cpp_dir)/include/IceUtil/Lock.h" "$(ice_cpp_dir)/include/IceUtil/ThreadException.h" "$(ice_cpp_dir)/include/IceUtil/Time.h" "$(ice_cpp_dir)/include/IceUtil/MutexProtocol.h" "$(ice_cpp_dir)/include/Ice/UserExceptionFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryF.h" "$(ice_cpp_dir)/include/Ice/Version.h" "$(ice_cpp_dir)/include/Ice/LocalException.h" "$(ice_cpp_dir)/include/Ice/Identity.h" "$(ice_cpp_dir)/include/Ice/Properties.h" "$(ice_cpp_dir)/include/Ice/Proxy.h" "$(ice_cpp_dir)/include/Ice/ProxyFactoryF.h" "$(ice_cpp_dir)/include/Ice/ConnectionIF.h" "$(ice_cpp_dir)/include/Ice/RequestHandlerF.h" "$(ice_cpp_dir)/include/Ice/EndpointIF.h" "$(ice_cpp_dir)/include/Ice/EndpointF.h" "$(ice_cpp_dir)/include/Ice/EndpointTypes.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapterF.h" "$(ice_cpp_dir)/include/Ice/ReferenceF.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsync.h" "$(ice_cpp_dir)/include/IceUtil/Monitor.h" "$(ice_cpp_dir)/include/IceUtil/Cond.h" "$(ice_cpp_dir)/include/IceUtil/Timer.h" "$(ice_cpp_dir)/include/IceUtil/Thread.h" "$(ice_cpp_dir)/include/IceUtil/UniquePtr.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h" "$(ice_cpp_dir)/include/Ice/Current.h" "$(ice_cpp_dir)/include/Ice/BasicStream.h" "$(ice_cpp_dir)/include/Ice/Object.h" "$(ice_cpp_dir)/include/Ice/GCShared.h" "$(ice_cpp_dir)/include/Ice/GCCountMap.h" "$(ice_cpp_dir)/include/Ice/IncomingAsyncF.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h" "$(ice_cpp_dir)/include/Ice/Buffer.h" "$(ice_cpp_dir)/include/Ice/Protocol.h" "$(ice_cpp_dir)/include/Ice/SlicedDataF.h" "$(ice_cpp_dir)/include/Ice/ObserverHelper.h" "$(ice_cpp_dir)/include/Ice/Instrumentation.h" "$(ice_cpp_dir)/include/Ice/Outgoing.h" "$(ice_cpp_dir)/include/Ice/Incoming.h" "$(ice_cpp_dir)/include/Ice/ServantLocatorF.h" "$(ice_cpp_dir)/include/Ice/ServantManagerF.h" "$(ice_cpp_dir)/include/Ice/IncomingAsync.h" "$(ice_cpp_dir)/include/Ice/Direct.h" "$(ice_cpp_dir)/include/Ice/Logger.h" "$(ice_cpp_dir)/include/Ice/LoggerUtil.h" "$(ice_cpp_dir)/include/Ice/Stats.h" "$(ice_cpp_dir)/include/Ice/Communicator.h" "$(ice_cpp_dir)/include/Ice/RouterF.h" "$(ice_cpp_dir)/include/Ice/LocatorF.h" "$(ice_cpp_dir)/include/Ice/PluginF.h" "$(ice_cpp_dir)/include/Ice/ImplicitContextF.h" "$(ice_cpp_dir)/include/Ice/CommunicatorAsync.h" "$(ice_cpp_dir)/include/Ice/ObjectFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapter.h" "$(ice_cpp_dir)/include/Ice/FacetMap.h" "$(ice_cpp_dir)/include/Ice/Endpoint.h" "$(ice_cpp_dir)/include/Ice/ServantLocator.h" "$(ice_cpp_dir)/include/Ice/SlicedData.h" "$(ice_cpp_dir)/include/Ice/Process.h" "$(ice_cpp_dir)/include/Ice/Application.h" "$(ice_cpp_dir)/include/Ice/Connection.h" "$(ice_cpp_dir)/include/Ice/ConnectionAsync.h" "$(ice_cpp_dir)/include/Ice/Functional.h" "$(ice_cpp_dir)/include/IceUtil/Functional.h" "$(ice_cpp_dir)/include/Ice/Stream.h" "$(ice_cpp_dir)/include/Ice/ImplicitContext.h" "$(ice_cpp_dir)/include/Ice/Locator.h" "$(ice_cpp_dir)/include/Ice/FactoryTableInit.h" "$(ice_cpp_dir)/include/Ice/ProcessF.h" "$(ice_cpp_dir)/include/Ice/Router.h" "$(ice_cpp_dir)/include/Ice/DispatchInterceptor.h" "$(ice_cpp_dir)/include/Ice/PropertiesAdmin.h" "$(ice_cpp_dir)/include/Ice/Metrics.h" "$(ice_cpp_dir)/include/Ice/Service.h" "$(ice_cpp_dir)/include/Ice/IconvStringConverter.h" Hello.h Person.pb.h StreamProtobuf.h +HelloI$(OBJEXT): HelloI.cpp "$(ice_cpp_dir)/include/IceUtil/IceUtil.h" "$(ice_cpp_dir)/include/IceUtil/Config.h" "$(ice_cpp_dir)/include/IceUtil/AbstractMutex.h" "$(ice_cpp_dir)/include/IceUtil/Lock.h" "$(ice_cpp_dir)/include/IceUtil/ThreadException.h" "$(ice_cpp_dir)/include/IceUtil/Exception.h" "$(ice_cpp_dir)/include/IceUtil/Time.h" "$(ice_cpp_dir)/include/IceUtil/Cache.h" "$(ice_cpp_dir)/include/IceUtil/Handle.h" "$(ice_cpp_dir)/include/IceUtil/Mutex.h" "$(ice_cpp_dir)/include/IceUtil/MutexProtocol.h" "$(ice_cpp_dir)/include/IceUtil/CountDownLatch.h" "$(ice_cpp_dir)/include/IceUtil/Cond.h" "$(ice_cpp_dir)/include/IceUtil/CtrlCHandler.h" "$(ice_cpp_dir)/include/IceUtil/Functional.h" "$(ice_cpp_dir)/include/IceUtil/Monitor.h" "$(ice_cpp_dir)/include/IceUtil/MutexPtrLock.h" "$(ice_cpp_dir)/include/IceUtil/RecMutex.h" "$(ice_cpp_dir)/include/IceUtil/ScopedArray.h" "$(ice_cpp_dir)/include/IceUtil/Shared.h" "$(ice_cpp_dir)/include/IceUtil/Thread.h" "$(ice_cpp_dir)/include/IceUtil/Timer.h" "$(ice_cpp_dir)/include/IceUtil/UUID.h" "$(ice_cpp_dir)/include/IceUtil/Unicode.h" "$(ice_cpp_dir)/include/IceUtil/UniquePtr.h" "$(ice_cpp_dir)/include/Ice/Ice.h" "$(ice_cpp_dir)/include/Ice/Initialize.h" "$(ice_cpp_dir)/include/Ice/CommunicatorF.h" "$(ice_cpp_dir)/include/Ice/ProxyF.h" "$(ice_cpp_dir)/include/Ice/Config.h" "$(ice_cpp_dir)/include/Ice/ProxyHandle.h" "$(ice_cpp_dir)/include/Ice/ObjectF.h" "$(ice_cpp_dir)/include/Ice/Handle.h" "$(ice_cpp_dir)/include/Ice/Exception.h" "$(ice_cpp_dir)/include/Ice/Format.h" "$(ice_cpp_dir)/include/Ice/StreamF.h" "$(ice_cpp_dir)/include/Ice/LocalObject.h" "$(ice_cpp_dir)/include/Ice/LocalObjectF.h" "$(ice_cpp_dir)/include/Ice/StreamHelpers.h" "$(ice_cpp_dir)/include/IceUtil/Iterator.h" "$(ice_cpp_dir)/include/IceUtil/Optional.h" "$(ice_cpp_dir)/include/Ice/UndefSysMacros.h" "$(ice_cpp_dir)/include/Ice/PropertiesF.h" "$(ice_cpp_dir)/include/Ice/InstanceF.h" "$(ice_cpp_dir)/include/Ice/LoggerF.h" "$(ice_cpp_dir)/include/Ice/StatsF.h" "$(ice_cpp_dir)/include/Ice/InstrumentationF.h" "$(ice_cpp_dir)/include/Ice/Dispatcher.h" "$(ice_cpp_dir)/include/Ice/ConnectionF.h" "$(ice_cpp_dir)/include/Ice/StringConverter.h" "$(ice_cpp_dir)/include/Ice/Plugin.h" "$(ice_cpp_dir)/include/Ice/BuiltinSequences.h" "$(ice_cpp_dir)/include/Ice/FactoryTable.h" "$(ice_cpp_dir)/include/Ice/UserExceptionFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryF.h" "$(ice_cpp_dir)/include/Ice/Version.h" "$(ice_cpp_dir)/include/Ice/LocalException.h" "$(ice_cpp_dir)/include/Ice/Identity.h" "$(ice_cpp_dir)/include/Ice/Properties.h" "$(ice_cpp_dir)/include/Ice/Proxy.h" "$(ice_cpp_dir)/include/Ice/ProxyFactoryF.h" "$(ice_cpp_dir)/include/Ice/ConnectionIF.h" "$(ice_cpp_dir)/include/Ice/RequestHandlerF.h" "$(ice_cpp_dir)/include/Ice/EndpointIF.h" "$(ice_cpp_dir)/include/Ice/EndpointF.h" "$(ice_cpp_dir)/include/Ice/EndpointTypes.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapterF.h" "$(ice_cpp_dir)/include/Ice/ReferenceF.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsync.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h" "$(ice_cpp_dir)/include/Ice/Current.h" "$(ice_cpp_dir)/include/Ice/BasicStream.h" "$(ice_cpp_dir)/include/Ice/Object.h" "$(ice_cpp_dir)/include/Ice/GCShared.h" "$(ice_cpp_dir)/include/Ice/GCCountMap.h" "$(ice_cpp_dir)/include/Ice/IncomingAsyncF.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h" "$(ice_cpp_dir)/include/Ice/Buffer.h" "$(ice_cpp_dir)/include/Ice/Protocol.h" "$(ice_cpp_dir)/include/Ice/SlicedDataF.h" "$(ice_cpp_dir)/include/Ice/ObserverHelper.h" "$(ice_cpp_dir)/include/Ice/Instrumentation.h" "$(ice_cpp_dir)/include/Ice/Outgoing.h" "$(ice_cpp_dir)/include/Ice/Incoming.h" "$(ice_cpp_dir)/include/Ice/ServantLocatorF.h" "$(ice_cpp_dir)/include/Ice/ServantManagerF.h" "$(ice_cpp_dir)/include/Ice/IncomingAsync.h" "$(ice_cpp_dir)/include/Ice/Direct.h" "$(ice_cpp_dir)/include/Ice/Logger.h" "$(ice_cpp_dir)/include/Ice/LoggerUtil.h" "$(ice_cpp_dir)/include/Ice/Stats.h" "$(ice_cpp_dir)/include/Ice/Communicator.h" "$(ice_cpp_dir)/include/Ice/RouterF.h" "$(ice_cpp_dir)/include/Ice/LocatorF.h" "$(ice_cpp_dir)/include/Ice/PluginF.h" "$(ice_cpp_dir)/include/Ice/ImplicitContextF.h" "$(ice_cpp_dir)/include/Ice/CommunicatorAsync.h" "$(ice_cpp_dir)/include/Ice/ObjectFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapter.h" "$(ice_cpp_dir)/include/Ice/FacetMap.h" "$(ice_cpp_dir)/include/Ice/Endpoint.h" "$(ice_cpp_dir)/include/Ice/ServantLocator.h" "$(ice_cpp_dir)/include/Ice/SlicedData.h" "$(ice_cpp_dir)/include/Ice/Process.h" "$(ice_cpp_dir)/include/Ice/Application.h" "$(ice_cpp_dir)/include/Ice/Connection.h" "$(ice_cpp_dir)/include/Ice/ConnectionAsync.h" "$(ice_cpp_dir)/include/Ice/Functional.h" "$(ice_cpp_dir)/include/Ice/Stream.h" "$(ice_cpp_dir)/include/Ice/ImplicitContext.h" "$(ice_cpp_dir)/include/Ice/Locator.h" "$(ice_cpp_dir)/include/Ice/FactoryTableInit.h" "$(ice_cpp_dir)/include/Ice/ProcessF.h" "$(ice_cpp_dir)/include/Ice/Router.h" "$(ice_cpp_dir)/include/Ice/DispatchInterceptor.h" "$(ice_cpp_dir)/include/Ice/PropertiesAdmin.h" "$(ice_cpp_dir)/include/Ice/Metrics.h" "$(ice_cpp_dir)/include/Ice/Service.h" "$(ice_cpp_dir)/include/Ice/IconvStringConverter.h" HelloI.h Hello.h Person.pb.h StreamProtobuf.h +Server$(OBJEXT): Server.cpp "$(ice_cpp_dir)/include/Ice/Ice.h" "$(ice_cpp_dir)/include/IceUtil/Config.h" "$(ice_cpp_dir)/include/Ice/Initialize.h" "$(ice_cpp_dir)/include/Ice/CommunicatorF.h" "$(ice_cpp_dir)/include/Ice/ProxyF.h" "$(ice_cpp_dir)/include/IceUtil/Shared.h" "$(ice_cpp_dir)/include/Ice/Config.h" "$(ice_cpp_dir)/include/Ice/ProxyHandle.h" "$(ice_cpp_dir)/include/IceUtil/Handle.h" "$(ice_cpp_dir)/include/IceUtil/Exception.h" "$(ice_cpp_dir)/include/Ice/ObjectF.h" "$(ice_cpp_dir)/include/Ice/Handle.h" "$(ice_cpp_dir)/include/Ice/Exception.h" "$(ice_cpp_dir)/include/Ice/Format.h" "$(ice_cpp_dir)/include/Ice/StreamF.h" "$(ice_cpp_dir)/include/Ice/LocalObject.h" "$(ice_cpp_dir)/include/Ice/LocalObjectF.h" "$(ice_cpp_dir)/include/Ice/StreamHelpers.h" "$(ice_cpp_dir)/include/IceUtil/ScopedArray.h" "$(ice_cpp_dir)/include/IceUtil/Iterator.h" "$(ice_cpp_dir)/include/IceUtil/Optional.h" "$(ice_cpp_dir)/include/Ice/UndefSysMacros.h" "$(ice_cpp_dir)/include/Ice/PropertiesF.h" "$(ice_cpp_dir)/include/Ice/InstanceF.h" "$(ice_cpp_dir)/include/Ice/LoggerF.h" "$(ice_cpp_dir)/include/Ice/StatsF.h" "$(ice_cpp_dir)/include/Ice/InstrumentationF.h" "$(ice_cpp_dir)/include/Ice/Dispatcher.h" "$(ice_cpp_dir)/include/Ice/ConnectionF.h" "$(ice_cpp_dir)/include/Ice/StringConverter.h" "$(ice_cpp_dir)/include/Ice/Plugin.h" "$(ice_cpp_dir)/include/Ice/BuiltinSequences.h" "$(ice_cpp_dir)/include/IceUtil/Unicode.h" "$(ice_cpp_dir)/include/Ice/FactoryTable.h" "$(ice_cpp_dir)/include/IceUtil/Mutex.h" "$(ice_cpp_dir)/include/IceUtil/Lock.h" "$(ice_cpp_dir)/include/IceUtil/ThreadException.h" "$(ice_cpp_dir)/include/IceUtil/Time.h" "$(ice_cpp_dir)/include/IceUtil/MutexProtocol.h" "$(ice_cpp_dir)/include/Ice/UserExceptionFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryF.h" "$(ice_cpp_dir)/include/Ice/Version.h" "$(ice_cpp_dir)/include/Ice/LocalException.h" "$(ice_cpp_dir)/include/Ice/Identity.h" "$(ice_cpp_dir)/include/Ice/Properties.h" "$(ice_cpp_dir)/include/Ice/Proxy.h" "$(ice_cpp_dir)/include/Ice/ProxyFactoryF.h" "$(ice_cpp_dir)/include/Ice/ConnectionIF.h" "$(ice_cpp_dir)/include/Ice/RequestHandlerF.h" "$(ice_cpp_dir)/include/Ice/EndpointIF.h" "$(ice_cpp_dir)/include/Ice/EndpointF.h" "$(ice_cpp_dir)/include/Ice/EndpointTypes.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapterF.h" "$(ice_cpp_dir)/include/Ice/ReferenceF.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsync.h" "$(ice_cpp_dir)/include/IceUtil/Monitor.h" "$(ice_cpp_dir)/include/IceUtil/Cond.h" "$(ice_cpp_dir)/include/IceUtil/Timer.h" "$(ice_cpp_dir)/include/IceUtil/Thread.h" "$(ice_cpp_dir)/include/IceUtil/UniquePtr.h" "$(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h" "$(ice_cpp_dir)/include/Ice/Current.h" "$(ice_cpp_dir)/include/Ice/BasicStream.h" "$(ice_cpp_dir)/include/Ice/Object.h" "$(ice_cpp_dir)/include/Ice/GCShared.h" "$(ice_cpp_dir)/include/Ice/GCCountMap.h" "$(ice_cpp_dir)/include/Ice/IncomingAsyncF.h" "$(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h" "$(ice_cpp_dir)/include/Ice/Buffer.h" "$(ice_cpp_dir)/include/Ice/Protocol.h" "$(ice_cpp_dir)/include/Ice/SlicedDataF.h" "$(ice_cpp_dir)/include/Ice/ObserverHelper.h" "$(ice_cpp_dir)/include/Ice/Instrumentation.h" "$(ice_cpp_dir)/include/Ice/Outgoing.h" "$(ice_cpp_dir)/include/Ice/Incoming.h" "$(ice_cpp_dir)/include/Ice/ServantLocatorF.h" "$(ice_cpp_dir)/include/Ice/ServantManagerF.h" "$(ice_cpp_dir)/include/Ice/IncomingAsync.h" "$(ice_cpp_dir)/include/Ice/Direct.h" "$(ice_cpp_dir)/include/Ice/Logger.h" "$(ice_cpp_dir)/include/Ice/LoggerUtil.h" "$(ice_cpp_dir)/include/Ice/Stats.h" "$(ice_cpp_dir)/include/Ice/Communicator.h" "$(ice_cpp_dir)/include/Ice/RouterF.h" "$(ice_cpp_dir)/include/Ice/LocatorF.h" "$(ice_cpp_dir)/include/Ice/PluginF.h" "$(ice_cpp_dir)/include/Ice/ImplicitContextF.h" "$(ice_cpp_dir)/include/Ice/CommunicatorAsync.h" "$(ice_cpp_dir)/include/Ice/ObjectFactory.h" "$(ice_cpp_dir)/include/Ice/ObjectAdapter.h" "$(ice_cpp_dir)/include/Ice/FacetMap.h" "$(ice_cpp_dir)/include/Ice/Endpoint.h" "$(ice_cpp_dir)/include/Ice/ServantLocator.h" "$(ice_cpp_dir)/include/Ice/SlicedData.h" "$(ice_cpp_dir)/include/Ice/Process.h" "$(ice_cpp_dir)/include/Ice/Application.h" "$(ice_cpp_dir)/include/Ice/Connection.h" "$(ice_cpp_dir)/include/Ice/ConnectionAsync.h" "$(ice_cpp_dir)/include/Ice/Functional.h" "$(ice_cpp_dir)/include/IceUtil/Functional.h" "$(ice_cpp_dir)/include/Ice/Stream.h" "$(ice_cpp_dir)/include/Ice/ImplicitContext.h" "$(ice_cpp_dir)/include/Ice/Locator.h" "$(ice_cpp_dir)/include/Ice/FactoryTableInit.h" "$(ice_cpp_dir)/include/Ice/ProcessF.h" "$(ice_cpp_dir)/include/Ice/Router.h" "$(ice_cpp_dir)/include/Ice/DispatchInterceptor.h" "$(ice_cpp_dir)/include/Ice/PropertiesAdmin.h" "$(ice_cpp_dir)/include/Ice/Metrics.h" "$(ice_cpp_dir)/include/Ice/Service.h" "$(ice_cpp_dir)/include/Ice/IconvStringConverter.h" HelloI.h Hello.h Person.pb.h StreamProtobuf.h diff --git a/protobuf/demo/cpp/.gitignore b/protobuf/demo/cpp/.gitignore new file mode 100644 index 00000000000..0c7a711fcec --- /dev/null +++ b/protobuf/demo/cpp/.gitignore @@ -0,0 +1,9 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Hello.cpp +Hello.h +Person.pb.cpp +Person.pb.h diff --git a/protobuf/demo/cpp/Client.cpp b/protobuf/demo/cpp/Client.cpp new file mode 100644 index 00000000000..61b238d53ab --- /dev/null +++ b/protobuf/demo/cpp/Client.cpp @@ -0,0 +1,117 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Hello.h> + +using namespace std; +using namespace Demo; + +class HelloClient : public Ice::Application +{ +public: + + HelloClient(); + + virtual int run(int, char*[]); + +private: + + void menu(); +}; + +int +main(int argc, char* argv[]) +{ + HelloClient app; + return app.main(argc, argv, "config.client"); +} + +HelloClient::HelloClient() : + // + // Since this is an interactive demo we don't want any signal + // handling. + // + Ice::Application(Ice::NoSignalHandling) +{ +} + +int +HelloClient::run(int argc, char* argv[]) +{ + if(argc > 1) + { + cerr << appName() << ": too many arguments" << endl; + return EXIT_FAILURE; + } + + HelloPrx hello = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy")); + if(!hello) + { + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; + } + + tutorial::Person p; + p.set_id(1); + p.set_name("Fred Jones"); + p.set_email("fred@jones.com"); + + menu(); + + char c; + do + { + try + { + cout << "==> "; + cin >> c; + if(c == 't') + { + hello->sayHello(p); + } + else if(c == 's') + { + hello->shutdown(); + } + else if(c == 'x') + { + // Nothing to do + } + else if(c == '?') + { + menu(); + } + else + { + cout << "unknown command `" << c << "'" << endl; + menu(); + } + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + } + } + while(cin.good() && c != 'x'); + + return EXIT_SUCCESS; +} + +void +HelloClient::menu() +{ + cout << + "usage:\n" + "t: send greeting\n" + "s: shutdown server\n" + "x: exit\n" + "?: help\n"; +} diff --git a/protobuf/demo/cpp/Hello.ice b/protobuf/demo/cpp/Hello.ice new file mode 100644 index 00000000000..4acc0b046d9 --- /dev/null +++ b/protobuf/demo/cpp/Hello.ice @@ -0,0 +1,30 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +[["cpp:include:Person.pb.h"]] +[["cpp:include:StreamProtobuf.h"]] + +module Demo +{ + +["cpp:type:tutorial::Person"] sequence<byte> Person; + +interface Hello +{ + idempotent void sayHello(Person p); + void shutdown(); +}; + +}; + +#endif diff --git a/protobuf/demo/cpp/HelloI.cpp b/protobuf/demo/cpp/HelloI.cpp new file mode 100644 index 00000000000..dfd9864c99f --- /dev/null +++ b/protobuf/demo/cpp/HelloI.cpp @@ -0,0 +1,28 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <IceUtil/IceUtil.h> +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +void +HelloI::sayHello(const tutorial::Person& p, const Ice::Current&) +{ + cout << "Hello World from " << p.DebugString() << endl; +} + +void +HelloI::shutdown(const Ice::Current& c) +{ + cout << "Shutting down..." << endl; + c.adapter->getCommunicator()->shutdown(); +} diff --git a/protobuf/demo/cpp/HelloI.h b/protobuf/demo/cpp/HelloI.h new file mode 100644 index 00000000000..2a0809cbcdb --- /dev/null +++ b/protobuf/demo/cpp/HelloI.h @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef HELLO_I_H +#define HELLO_I_H + +#include <Hello.h> + +class HelloI : public Demo::Hello +{ +public: + + virtual void sayHello(const tutorial::Person& p, const Ice::Current&); + virtual void shutdown(const Ice::Current&); +}; + +#endif diff --git a/protobuf/demo/cpp/Ice.protobuf.client.vcxproj b/protobuf/demo/cpp/Ice.protobuf.client.vcxproj new file mode 100755 index 00000000000..908c0df5361 --- /dev/null +++ b/protobuf/demo/cpp/Ice.protobuf.client.vcxproj @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <None Include="Hello.ice" /> + <CustomBuild Include="Person.proto"> + <FileType>Document</FileType> + <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">protoc --cpp_out=. Person.proto +move Person.pb.cc Person.pb.cpp</Command> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)%(Filename).pb.h;$(ProjectDir)%(Filename).pb.cpp</Outputs> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)%(Filename).pb.h;$(ProjectDir)%(Filename).pb.cpp</Outputs> + <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">protoc --cpp_out=. Person.proto +move Person.pb.cc Person.pb.cpp</Command> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ClCompile Include="Client.cpp" /> + <ClCompile Include="generated\Hello.cpp" /> + <ClCompile Include="Person.pb.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="generated\Hello.h" /> + <ClInclude Include="Person.pb.h" /> + <ClInclude Include="StreamProtobuf.h" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{606BCE06-A612-4019-95EE-F863672E09D8}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>Iceprotobufclient</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ALLUSERSPROFILE)\ZeroC\Ice.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ALLUSERSPROFILE)\ZeroC\Ice.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + <ExecutablePath>$(IceBin);$(ExecutablePath)</ExecutablePath> + <IncludePath>$(IceInclude);$(IncludePath)</IncludePath> + <LibraryPath>$(IceLib);$(LibraryPath)</LibraryPath> + <TargetName>client</TargetName> + <OutDir>$(SolutionDir)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <ExecutablePath>$(IceBin);$(ExecutablePath)</ExecutablePath> + <IncludePath>$(IceInclude);$(IncludePath)</IncludePath> + <LibraryPath>$(IceLib);$(LibraryPath)</LibraryPath> + <TargetName>client</TargetName> + <OutDir>$(SolutionDir)\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>.;generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>iced.lib;iceutild.lib;libprotobufd.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>.;generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>ice.lib;iceutil.lib;libprotobuf.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> + <ProjectExtensions> + <VisualStudio> + <UserProperties ZerocIce_Enabled="True" ZerocIce_OutputDir="generated" ZerocIce_ProjectVersion="1" /> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/protobuf/demo/cpp/Ice.protobuf.server.vcxproj b/protobuf/demo/cpp/Ice.protobuf.server.vcxproj new file mode 100755 index 00000000000..dabfe458865 --- /dev/null +++ b/protobuf/demo/cpp/Ice.protobuf.server.vcxproj @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <None Include="Hello.ice" /> + <CustomBuild Include="Person.proto"> + <FileType>Document</FileType> + <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">protoc --cpp_out=. Person.proto +move Person.pb.cc Person.pb.cpp</Command> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)%(Filename).pb.h;$(ProjectDir)%(Filename).pb.cpp</Outputs> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)%(Filename).pb.h;$(ProjectDir)%(Filename).pb.cpp</Outputs> + <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">protoc --cpp_out=. Person.proto +move Person.pb.cc Person.pb.cpp</Command> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ClCompile Include="HelloI.cpp" /> + <ClCompile Include="Server.cpp" /> + <ClCompile Include="generated\Hello.cpp" /> + <ClCompile Include="Person.pb.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="generated\Hello.h" /> + <ClInclude Include="HelloI.h" /> + <ClInclude Include="Person.pb.h" /> + <ClInclude Include="StreamProtobuf.h" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C8629E21-7608-429E-8EA4-07398AD75BDB}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>Iceprotobufserver</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ALLUSERSPROFILE)\ZeroC\Ice.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ALLUSERSPROFILE)\ZeroC\Ice.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + <ExecutablePath>$(IceBin);$(ExecutablePath);C:\pb-2.5.0\bin</ExecutablePath> + <IncludePath>$(IceInclude);$(IncludePath);C:\pb-2.5.0\include</IncludePath> + <LibraryPath>$(IceLib);$(LibraryPath);C:\pb-2.5.0\lib</LibraryPath> + <TargetName>server</TargetName> + <OutDir>$(SolutionDir)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <ExecutablePath>$(IceBin);$(ExecutablePath);C:\pb-2.5.0\bin</ExecutablePath> + <IncludePath>$(IceInclude);$(IncludePath);C:\pb-2.5.0\include</IncludePath> + <LibraryPath>$(IceLib);$(LibraryPath);C:\pb-2.5.0\lib</LibraryPath> + <TargetName>server</TargetName> + <OutDir>$(SolutionDir)\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>.;generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>iced.lib;iceutild.lib;libprotobufd.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>.;generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies>ice.lib;iceutil.lib;libprotobuf.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> + <ProjectExtensions> + <VisualStudio> + <UserProperties ZerocIce_Enabled="True" ZerocIce_OutputDir="generated" ZerocIce_ProjectVersion="1" /> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/protobuf/demo/cpp/Ice.protobuf.sln b/protobuf/demo/cpp/Ice.protobuf.sln new file mode 100755 index 00000000000..67cdaa740a5 --- /dev/null +++ b/protobuf/demo/cpp/Ice.protobuf.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.protobuf.client", "Ice.protobuf.client.vcxproj", "{606BCE06-A612-4019-95EE-F863672E09D8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.protobuf.server", "Ice.protobuf.server.vcxproj", "{C8629E21-7608-429E-8EA4-07398AD75BDB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {606BCE06-A612-4019-95EE-F863672E09D8}.Debug|Win32.ActiveCfg = Debug|Win32 + {606BCE06-A612-4019-95EE-F863672E09D8}.Debug|Win32.Build.0 = Debug|Win32 + {606BCE06-A612-4019-95EE-F863672E09D8}.Release|Win32.ActiveCfg = Release|Win32 + {606BCE06-A612-4019-95EE-F863672E09D8}.Release|Win32.Build.0 = Release|Win32 + {C8629E21-7608-429E-8EA4-07398AD75BDB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C8629E21-7608-429E-8EA4-07398AD75BDB}.Debug|Win32.Build.0 = Debug|Win32 + {C8629E21-7608-429E-8EA4-07398AD75BDB}.Release|Win32.ActiveCfg = Release|Win32 + {C8629E21-7608-429E-8EA4-07398AD75BDB}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/protobuf/demo/cpp/Makefile b/protobuf/demo/cpp/Makefile new file mode 100644 index 00000000000..d63c5fd3a6c --- /dev/null +++ b/protobuf/demo/cpp/Makefile @@ -0,0 +1,67 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# If protobuf is not installed in a standard location where the +# compiler can find it, set PROTOBUF_HOME to the protobuf installation +# directory. +# +PROTOBUF_HOME ?= /usr/local + +top_srcdir = ../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Hello.o \ + Person.pb.o + +COBJS = Client.o + +SOBJS = HelloI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +SLICE_SRCS = Hello.ice +PROTO_SRCS = Person.proto + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := $(ICE_FLAGS) -I$(PROTOBUF_HOME)/include -I. $(CPPFLAGS) +LIBS := $(ICE_LIB_DIR) $(LIBS) -L$(PROTOBUF_HOME)/lib -lprotobuf + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +%..pb.h %.pb.cpp: %.proto + rm -f $(*F).pb.h $(*F).pb.cpp + $(PROTOBUF_HOME)/bin/protoc --cpp_out=. $(*F).proto + mv $(*F).pb.cc $(*F).pb.cpp + +depend:: + for i in $(PROTO_SRCS); do \ + echo "$${i%.proto}.pb.cpp: $$i" >> .depend; \ + done + +clean:: + rm -f $(addsuffix .pb.cpp, $(basename $(notdir $(PROTO_SRCS)))) + rm -f $(addsuffix .pb.h, $(basename $(notdir $(PROTO_SRCS)))) + +include .depend diff --git a/protobuf/demo/cpp/Makefile.mak b/protobuf/demo/cpp/Makefile.mak new file mode 100644 index 00000000000..4c886bd91d7 --- /dev/null +++ b/protobuf/demo/cpp/Makefile.mak @@ -0,0 +1,77 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# If protobuf is not installed in a standard location where the +# compiler can find it, set PROTOBUF_HOME to the protobuf installation +# directory. +# +!if "$(PROTOBUF_HOME)" == "" +PROTOBUF_HOME = c:\protobuf +!endif + +top_srcdir = ..\.. + +CLIENT = client.exe +SERVER = server.exe + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Hello.obj \ + Person.pb.obj + +COBJS = Client.obj + +SOBJS = HelloI.obj \ + Server.obj + +SRCS = $(OBJS:.obj=.cpp) \ + $(COBJS:.obj=.cpp) \ + $(SOBJS:.obj=.cpp) + +!include $(top_srcdir)/config/Make.rules.mak + +# +# Need to use -W0 to get rid of ugly warnings from generated protobuf file as +# well as prevent compile failure on x64 due to warnings from protobuf headers +# +CPPFLAGS = $(ICE_CPPFLAGS) -I$(PROTOBUF_HOME)\include -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -W0 + +LIBS = $(ICE_LDFLAGS) $(LIBS) /libpath:$(PROTOBUF_HOME)\lib libprotobuf$(LIBSUFFIX).lib + +!if "$(GENERATE_PDB)" == "yes" +CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) +SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb) +!endif + +$(CLIENT): $(OBJS) $(COBJS) + $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(OBJS) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +$(SERVER): $(OBJS) $(SOBJS) + $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(OBJS) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +# A generic rule would be nicer, but since protoc generates .pb.cpp +# it is not possible with nmake. +Person.pb.cpp: Person.proto + del /q Person.pb.h Person.pb.cpp + $(PROTOBUF_HOME)\bin\protoc --cpp_out=. Person.proto + move Person.pb.cc Person.pb.cpp + +Person.pb.h: Person.pb.cpp + +clean:: + del /q Hello.cpp Hello.h + del /q Person.pb.h Person.pb.cpp + +!include .depend diff --git a/protobuf/demo/cpp/Person.proto b/protobuf/demo/cpp/Person.proto new file mode 100644 index 00000000000..c512c800570 --- /dev/null +++ b/protobuf/demo/cpp/Person.proto @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +package tutorial; + +message Person { + required int32 id = 1; + required string name = 2; + optional string email = 3; +} diff --git a/protobuf/demo/cpp/README b/protobuf/demo/cpp/README new file mode 100644 index 00000000000..b341a2f6cea --- /dev/null +++ b/protobuf/demo/cpp/README @@ -0,0 +1,117 @@ +Introduction +------------ + +This demo shows how to integrate Google Protocol Buffers with Ice. + +The Protocol Buffers distribution and documentation can be found at + + http://code.google.com/apis/protocolbuffers/ + +This demo was tested with Protocol Buffers version 2.5.0. + +The Slice-to-C++ compiler, slice2cpp, supports metadata that allows +you to specify an alternate mapping for a sequence<byte> type. The +generated code uses the type name you supply in place of the sequence +name. There are two prerequisites: you must add a metadata directive +to include the header file containing the definition of your alternate +type, and you must supply code that Ice can use to marshal and +unmarshal instances of your alternate type. + +For example, here is a metadata directive that specifies an alternate +type name for a byte sequence: + + ["cpp:type:tutorial::Person"] sequence<byte> Person; + +The type name specified in this example, tutorial::Person, corresponds +to the C++ class generated by the Protocol Buffers compiler (protoc) +for the definition shown below: + + package tutorial; + message Person { ... }; + +We must also add the following metadata directive before any other +Slice definitions to ensure the definition of tutorial::Person is +visible: + + [["cpp:include:Person.pb.h"]] + +Finally, we need to define the marshaling code. The header file +StreamProtobuf.h in this directory contains template definitions that +can be used with any Protocol Buffer message types. We also need to +include this code using a cpp:include metadata directive. + +Refer to Hello.ice in this directory for the complete example. + + +Building the demo on Linux/OS X/Unix +------------------------------------ + +If you are using a non-RPM install or have not installed Ice in the +default location (/opt/Ice-VERSION) then you will need to set the +environment variable ICE_HOME to point to the root directory of your +Ice installation: + + $ export ICE_HOME=<Ice installation root directory> + +Please review the Makefile in this directory and adjust the value +of PROTOBUF_HOME to reflect the installation directory of Protocol +Buffers on your system. + +Use this command to build the demo: + + $ make (or gmake depending on system) + + +Building the demo on Windows +---------------------------- + +For Windows, Visual Studio project files are provided for building the +demo. These projects require the Ice Visual Studio Add-In, which is +installed automatically by the Ice installer. + +Open the Ice.protobuf.sln solution. For each project, open the project +properties and modify the VC++ Directories. You will need to add the +Protocol Buffers bin directory to "Executable Directories", the +include directory to "Include Directories", and the lib directory to +"Library Directories". + +Next, select the target configuration (Debug or Release), right-click +on the solution in the Solution Explorer window and select +"Build Solution". + +Note that on Windows the Protocol Buffers source package does not +support automatic installation. The build system for this demo +assumes that you have compiled and manually installed Protocol Buffers +using the following directory structure: + +%PROTOBUF_HOME%\bin + + Contains protoc.exe + +%PROTOBUF_HOME%\lib + + Contains libprotobuf.lib and libprotobufd.lib, the release and + debug static libraries, respectively. (The debug library was + renamed to libprotobufd.lib.) + +%PROTOBUF_HOME%\include + + Contains the output of the extract_includes.bat batch file that + copies the include files contained in the Protocol Buffers + distribution. + + +Running the demo +---------------- + +First you must ensure that your environment is set up to run Ice +applications. Please see the documentation that came with your Ice +distribution for more information. + +To run the demo, first start the server: + + $ server + +In a separate window, start the client: + + $ client diff --git a/protobuf/demo/cpp/Server.cpp b/protobuf/demo/cpp/Server.cpp new file mode 100644 index 00000000000..c6202344ee8 --- /dev/null +++ b/protobuf/demo/cpp/Server.cpp @@ -0,0 +1,45 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +class HelloServer : public Ice::Application +{ +public: + + virtual int run(int, char*[]); +}; + +int +main(int argc, char* argv[]) +{ + HelloServer app; + return app.main(argc, argv, "config.server"); +} + +int +HelloServer::run(int argc, char* argv[]) +{ + if(argc > 1) + { + cerr << appName() << ": too many arguments" << endl; + return EXIT_FAILURE; + } + + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello"); + Demo::HelloPtr hello = new HelloI; + adapter->add(hello, communicator()->stringToIdentity("hello")); + adapter->activate(); + communicator()->waitForShutdown(); + return EXIT_SUCCESS; +} diff --git a/protobuf/demo/cpp/StreamProtobuf.h b/protobuf/demo/cpp/StreamProtobuf.h new file mode 100644 index 00000000000..ff2bfd665a9 --- /dev/null +++ b/protobuf/demo/cpp/StreamProtobuf.h @@ -0,0 +1,99 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef STREAM_PROTOBUF_H +#define STREAM_PROTOBUF_H + +#include <Ice/Ice.h> +#include <google/protobuf/message_lite.h> + +#ifdef ICE_CPP11 +#include <type_traits> +#endif + +// +// Tell Ice how to marshal and unmarshal a protobuf message to/from a sequence<byte> +// +namespace Ice +{ + +#ifdef ICE_CPP11 +// +// We'll use std::enable_if to give protobuf its own helper category (see below) +// +const StreamHelperCategory StreamHelperCategoryProtobuf = 100; +#else +// +// We just assume a single "custom" category: Unknown +// +const StreamHelperCategory StreamHelperCategoryProtobuf = StreamHelperCategoryUnknown; +#endif + +#ifdef ICE_CPP11 + +template<typename T> +struct StreamableTraits<T, typename std::enable_if<std::is_base_of< ::google::protobuf::MessageLite, T>::value >::type> +{ + static const StreamHelperCategory helper = StreamHelperCategoryProtobuf; + static const int minWireSize = 1; + static const bool fixedLength = false; +}; + +#else +// +// We use the default 'Unknown' StreamHelperCategory +// +#endif + +template<typename T> +struct StreamHelper<T, StreamHelperCategoryProtobuf> +{ + template<class S> static inline void + write(S* stream, const ::google::protobuf::MessageLite& v) + { + std::vector<Byte> data(v.ByteSize()); + if(!v.IsInitialized()) + { + throw MarshalException(__FILE__, __LINE__, + "message not fully initialized: " + v.InitializationErrorString()); + } + + Byte* r = v.SerializeWithCachedSizesToArray(&data[0]); + if(r != &data[0] + data.size()) + { + throw MarshalException(__FILE__, __LINE__, "message modified during marshaling"); + } + + stream->write(&data[0], &data[0] + data.size()); + } + + template<class S> static inline void + read(S* stream, ::google::protobuf::MessageLite& v) + { + std::pair<const Byte*, const Byte*> data; + stream->read(data); + if(!v.ParseFromArray(data.first, static_cast<int>(data.second - data.first))) + { + throw MarshalException(__FILE__, __LINE__, "ParseFromArray failed"); + } + } +}; + +// +// Use default marshaling/unmarshaling, with optionalFormat = OptionalFormatVSize +// +template<> +struct GetOptionalFormat<StreamHelperCategoryProtobuf, 1, false> +{ + static const OptionalFormat value = OptionalFormatVSize; +}; + +} +#endif diff --git a/protobuf/demo/cpp/config.client b/protobuf/demo/cpp/config.client new file mode 100644 index 00000000000..a02cab0f4cb --- /dev/null +++ b/protobuf/demo/cpp/config.client @@ -0,0 +1,23 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/demo/cpp/config.server b/protobuf/demo/cpp/config.server new file mode 100644 index 00000000000..309db9731b2 --- /dev/null +++ b/protobuf/demo/cpp/config.server @@ -0,0 +1,24 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/demo/java/Client.java b/protobuf/demo/java/Client.java new file mode 100644 index 00000000000..99ad29c04c2 --- /dev/null +++ b/protobuf/demo/java/Client.java @@ -0,0 +1,127 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +import Demo.*; + +public class Client extends Ice.Application +{ + class ShutdownHook extends Thread + { + public void + run() + { + try + { + communicator().destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + } + } + + private static void + menu() + { + System.out.println( + "usage:\n" + + "t: send greeting\n" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + public int + run(String[] args) + { + if(args.length > 0) + { + System.err.println(appName() + ": too many arguments"); + return 1; + } + + // + // Since this is an interactive demo we want to clear the + // Application installed interrupt callback and install our + // own shutdown hook. + // + setInterruptHook(new ShutdownHook()); + + HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy")); + if(hello == null) + { + System.err.println("invalid proxy"); + return 1; + } + + tutorial.PersonPB.Person p = tutorial.PersonPB.Person.newBuilder(). + setId(1).setName("Fred Jones").setEmail("fred@jones.com").build(); + + menu(); + + java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); + + String line = null; + do + { + try + { + System.out.print("==> "); + System.out.flush(); + line = in.readLine(); + if(line == null) + { + break; + } + if(line.equals("t")) + { + hello.sayHello(p); + } + else if(line.equals("s")) + { + hello.shutdown(); + } + else if(line.equals("x")) + { + // Nothing to do + } + else if(line.equals("?")) + { + menu(); + } + else + { + System.out.println("unknown command `" + line + "'"); + menu(); + } + } + catch(java.io.IOException ex) + { + ex.printStackTrace(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + } + while(!line.equals("x")); + + return 0; + } + + public static void + main(String[] args) + { + Client app = new Client(); + int status = app.main("Client", args, "config.client"); + System.exit(status); + } +} diff --git a/protobuf/demo/java/Hello.ice b/protobuf/demo/java/Hello.ice new file mode 100644 index 00000000000..c4f03b56b2a --- /dev/null +++ b/protobuf/demo/java/Hello.ice @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +module Demo +{ + +["java:protobuf:tutorial.PersonPB.Person"] sequence<byte> Person; + +interface Hello +{ + idempotent void sayHello(Person p); + void shutdown(); +}; + +}; + +#endif diff --git a/protobuf/demo/java/HelloI.java b/protobuf/demo/java/HelloI.java new file mode 100644 index 00000000000..9373fa072c2 --- /dev/null +++ b/protobuf/demo/java/HelloI.java @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +import Demo.*; + +public class HelloI extends _HelloDisp +{ + public void + sayHello(tutorial.PersonPB.Person p, Ice.Current current) + { + System.out.println("Hello World from " + p); + } + + public void + shutdown(Ice.Current current) + { + System.out.println("Shutting down..."); + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/protobuf/demo/java/Person.proto b/protobuf/demo/java/Person.proto new file mode 100644 index 00000000000..a2124b26160 --- /dev/null +++ b/protobuf/demo/java/Person.proto @@ -0,0 +1,19 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +package tutorial; + +option java_outer_classname = "PersonPB"; + +message Person { + required int32 id = 1; + required string name = 2; + optional string email = 3; +} diff --git a/protobuf/demo/java/README b/protobuf/demo/java/README new file mode 100644 index 00000000000..979dfb31523 --- /dev/null +++ b/protobuf/demo/java/README @@ -0,0 +1,86 @@ +Introduction +------------ + +This demo shows how to integrate Google Protocol Buffers with Ice. + +The Protocol Buffers distribution and documentation can be found at + + http://code.google.com/apis/protocolbuffers/ + +This demo was tested with Protocol Buffers version 2.5.0. + +Ice supports metadata that makes it possible for you to specify +Protocol Buffers message types in your Slice definitions, with Ice +handling the serialization chores for you automatically. The metadata, +which may only be used on a sequence<byte> type, has the following +syntax in Java: + + java:protobuf:protoc-generated-class + +For example: + + ["java:protobuf:tutorial.PersonPB.Person"] sequence<byte> Person; + +The type name specified in this example, tutorial.PersonPB.Person, +corresponds to the Java class generated by the Protocol Buffers +compiler (protoc) for the definition shown below: + + package tutorial; + option java_outer_classname = "PersonPB"; + message Person { ... }; + + +Building the demo +----------------- + +This demo uses an ant build task, located in the "ant" subdirectory, +for compiling .proto files. + +Building the demo requires Ant 1.7.0 or greater, which can be +downloaded at: + + http://ant.apache.org/bindownload.cgi + +If you are using a non-RPM install on Unix or have not installed Ice +in the default location (/opt/Ice-VERSION on Unix or C:\Ice-VERSION on +Windows) then you will need to set the environment variable ICE_HOME +to point to the root directory of your Ice installation. For example, +on Unix: + + $ export ICE_HOME=<Ice installation root directory> + +Or on Windows: + + > set ICE_HOME=<Ice installation root directory> + +Prior to building the demo, you should also add protoc to your PATH +and protobuf-java-2.5.0.jar to your CLASSPATH. + +Use this command to build the demo: + + $ ant + + +Running the demo +---------------- + +First you must ensure that your environment is set up to run Ice +applications. Please see the documentation that came with your Ice +distribution for more information. You will also need to add the +classes directory to your CLASSPATH. + +Unix: + + $ export CLASSPATH=$CLASSPATH:classes + +Windows: + + > set CLASSPATH=%CLASSPATH%;classes + +To run the demo, first start the server: + + $ java Server + +In a separate window, start the client: + + $ java Client diff --git a/protobuf/demo/java/Server.java b/protobuf/demo/java/Server.java new file mode 100644 index 00000000000..ae9ecfdaf05 --- /dev/null +++ b/protobuf/demo/java/Server.java @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +import Demo.*; + +public class Server extends Ice.Application +{ + public int + run(String[] args) + { + if(args.length > 0) + { + System.err.println(appName() + ": too many arguments"); + return 1; + } + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello"); + adapter.add(new HelloI(), communicator().stringToIdentity("hello")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } + + public static void + main(String[] args) + { + Server app = new Server(); + int status = app.main("Server", args, "config.server"); + System.exit(status); + } +} diff --git a/protobuf/demo/java/ant/ProtocTask.java b/protobuf/demo/java/ant/ProtocTask.java new file mode 100644 index 00000000000..2c52bf3b37d --- /dev/null +++ b/protobuf/demo/java/ant/ProtocTask.java @@ -0,0 +1,371 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +//package Ice.Ant; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.taskdefs.ExecTask; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.PumpStreamHandler; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.Commandline.Argument; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Reference; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.StringReader; +import java.io.BufferedReader; +import java.io.BufferedWriter; + +/** + * An ant task for protoc. + * + * Attributes specific to protoc: + * + * translator - The pathname of the translator (default: "protoc"). + * protocpath - The value for the --proto_path translator option. + * outputdir - The value for the --java_out translator option. + * dependencyfile - The file in which dependencies are stored (default: ".pbdepend"). + * + * Example: + * + * <project ...> + * <taskdef name="protoc" classname="ProtocTask" /> + * <property name="protoc.dir" value="../include/protoc"/> + * <target name="generate"> + * <mkdir dir="tags" /> + * <protoc tagdir="tags" outputdir="out"> + * <fileset dir="${protoc.dir}"> + * <include name="*.ice" /> + * </fileset> + * </protoc> + * </target> + * </project> + * + * The <taskdef> element installs the protoctask task. + */ +public class ProtocTask extends org.apache.tools.ant.Task +{ + public + ProtocTask() + { + _translator = null; + _outputDir = null; + _protocPath = null; + _outputDirString = null; + } + + public void + setDependencyFile(File file) + { + _dependencyFile = file; + } + + public void + setOutputdir(File dir) + { + _outputDir = dir; + _outputDirString = _outputDir.toString(); + if(_outputDirString.indexOf(' ') != -1) + { + _outputDirString = '"' + _outputDirString + '"'; + } + } + + public void + setProtocpath(File dir) + { + _protocPath = dir.toString(); + } + + public void + setTranslator(File prog) + { + _translator = prog; + } + + public FileSet + createFileset() + { + FileSet fileset = new FileSet(); + _fileSets.add(fileset); + + return fileset; + } + + @SuppressWarnings("unchecked") + public void + execute() + throws BuildException + { + if(_fileSets.isEmpty()) + { + throw new BuildException("No fileset specified"); + } + + // + // Read the set of dependencies for this task. + // + java.util.HashMap dependencies = readDependencies(); + + // + // Compose a list of the files that need to be translated. A + // file needs to translated if we can't find a dependency in + // the dependency table or if its dependency is not up-to-date + // anymore (the proto file changed since the dependency was + // last updated) + // + java.util.Vector<File> buildList = new java.util.Vector<File>(); + java.util.Vector<File> skipList = new java.util.Vector<File>(); + java.util.Iterator p = _fileSets.iterator(); + while(p.hasNext()) + { + FileSet fileset = (FileSet)p.next(); + + DirectoryScanner scanner = fileset.getDirectoryScanner(getProject()); + scanner.scan(); + String[] files = scanner.getIncludedFiles(); + for(int i = 0; i < files.length; i++) + { + File proto = new File(fileset.getDir(getProject()), files[i]); + + ProtoDependency depend = (ProtoDependency)dependencies.get(getTargetKey(proto.toString())); + if(depend == null || !depend.isUpToDate()) + { + buildList.addElement(proto); + } + else + { + skipList.addElement(proto); + } + } + + java.util.Iterator i = skipList.iterator(); + while(i.hasNext()) + { + File file = (File)i.next(); + log("skipping " + file.getName()); + } + } + + // + // Run the translator + // + if(!buildList.isEmpty()) + { + String translator; + if(_translator == null) + { + translator = "protoc"; + } + else + { + translator = _translator.toString(); + } + + StringBuilder cmd = new StringBuilder(128); + + // + // Add --java_out. + // + if(_outputDir != null) + { + cmd.append(" --java_out="); + cmd.append(stripDriveLetter(_outputDirString)); + } + + // + // Add --proto_path + // + if(_protocPath != null) + { + cmd.append(" --proto_path="); + cmd.append(stripDriveLetter(_protocPath)); + } + + // + // Add files to be translated + // + for(int i = 0; i < buildList.size(); i++) + { + File f = (File)buildList.elementAt(i); + cmd.append(" "); + String s = stripDriveLetter(f.toString()); + if(s.indexOf(' ') != -1) + { + cmd.append('"'); + cmd.append(s); + cmd.append('"'); + } + else + { + cmd.append(s); + } + } + + // + // Execute + // + log(translator + " " + cmd); + ExecTask task = (ExecTask)getProject().createTask("exec"); + task.setFailonerror(true); + Argument arg = task.createArg(); + arg.setLine(cmd.toString()); + task.setExecutable(translator); + task.execute(); + + // + // Update dependency file. + // + for(int i = 0; i < buildList.size(); i++) + { + ProtoDependency depend = new ProtoDependency(); + depend._timeStamp = new java.util.Date().getTime(); + depend._dependency = ((File)buildList.elementAt(i)).toString(); + dependencies.put(getTargetKey(depend._dependency), depend); + } + + writeDependencies(dependencies); + } + } + + private String + getTargetKey(String proto) + { + // + // Since the dependency file can be shared by several proto + // tasks we need to make sure that each dependency has a + // unique key. We use the name of the task, the output + // directory and the name of the proto file to be compiled. + // + // If there's two protoc tasks using the same dependency + // file, with the same output dir and which compiles the same + // protoc file they'll use the same dependency. + // + return "protoc " + _outputDir.toString() + " " + proto; + } + + // This is to work around a bug with protoc, where it does not + // accept drive letters in path names. See + // http://bugzilla/bugzilla/show_bug.cgi?id=3349 + // + private String + stripDriveLetter(String s) + { + if(s.length() > 1 && s.charAt(1) == ':') + { + return s.substring(2); + } + return s; + } + + // + // Read the dependency file. + // + private java.util.HashMap + readDependencies() + { + if(_dependencyFile == null) + { + if(_outputDir != null) + { + _dependencyFile = new File(_outputDir, ".pbdepend"); + } + else + { + _dependencyFile = new File(".pbdepend"); + } + } + + try + { + java.io.ObjectInputStream in = new java.io.ObjectInputStream(new java.io.FileInputStream(_dependencyFile)); + java.util.HashMap dependencies = (java.util.HashMap)in.readObject(); + in.close(); + return dependencies; + } + catch(java.io.IOException ex) + { + } + catch(java.lang.ClassNotFoundException ex) + { + } + + return new java.util.HashMap(); + } + + private void + writeDependencies(java.util.HashMap dependencies) + { + try + { + java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(new FileOutputStream(_dependencyFile)); + out.writeObject(dependencies); + out.close(); + } + catch(java.io.IOException ex) + { + throw new BuildException("Unable to write dependencies in file " + _dependencyFile.getPath() + ": " + ex); + } + } + + // + // A proto dependency. + // + // * the _timeStamp attribute contains the last time the proto + // file was compiled. + // + // * the _dependency attribute contains the .proto file. + // + private class ProtoDependency implements java.io.Serializable + { + private void writeObject(java.io.ObjectOutputStream out) + throws java.io.IOException + { + out.writeObject(_dependency); + out.writeLong(_timeStamp); + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException + { + _dependency = (String)in.readObject(); + _timeStamp = in.readLong(); + } + + public boolean + isUpToDate() + { + File dep = new File(_dependency); + if(!dep.exists() || _timeStamp < dep.lastModified()) + { + return false; + } + + return true; + } + + public String _dependency; + public long _timeStamp; + } + + private File _translator; + private File _dependencyFile; + private File _outputDir; + private String _outputDirString; + private String _protocPath; + private java.util.List<FileSet> _fileSets = new java.util.LinkedList<FileSet>(); +} diff --git a/protobuf/demo/java/build.xml b/protobuf/demo/java/build.xml new file mode 100644 index 00000000000..e70e7907133 --- /dev/null +++ b/protobuf/demo/java/build.xml @@ -0,0 +1,63 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. + + This copy of Ice Protobuf is licensed to you under the terms described + in the ICE_PROTOBUF_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="demo_Ice_protobuf" default="all" basedir="."> + + <!-- set global properties for this build --> + <property name="top.dir" value="../.."/> + + <!-- import common definitions --> + <import file="${top.dir}/config/common.xml"/> + + <target name="protoc" depends="init"> + <!-- Build protoc task --> + <mkdir dir="${class.dir}"/> + <javac srcdir="ant" destdir="${class.dir}" debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="generate" depends="protoc"> + <!-- Add the protoc task --> + <taskdef name="protoc" classpath="${class.dir}" classname="ProtocTask" /> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}"> + <meta value="${java2metadata}"/> + <fileset dir="." includes="Hello.ice"/> + </slice2java> + <protoc outputdir="${generated.dir}" protocpath="."> + <fileset dir="." includes="Person.proto"/> + </protoc> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir="${generated.dir}" destdir="${class.dir}" + debug="${debug}"> + <classpath refid="ice.classpath"/> + <compilerarg value="${javac.lint}"/> + </javac> + <javac srcdir="." destdir="${class.dir}" + excludes="generated/**, ant/**" debug="${debug}"> + <classpath refid="ice.classpath"/> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="all" depends="compile"/> + + <target name="clean"> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + </target> + +</project> diff --git a/protobuf/demo/java/config.client b/protobuf/demo/java/config.client new file mode 100644 index 00000000000..a02cab0f4cb --- /dev/null +++ b/protobuf/demo/java/config.client @@ -0,0 +1,23 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/demo/java/config.server b/protobuf/demo/java/config.server new file mode 100644 index 00000000000..309db9731b2 --- /dev/null +++ b/protobuf/demo/java/config.server @@ -0,0 +1,24 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/demo/python/Client.py b/protobuf/demo/python/Client.py new file mode 100644 index 00000000000..cfe8b99579d --- /dev/null +++ b/protobuf/demo/python/Client.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import sys, traceback, Ice + +Ice.loadSlice('Hello.ice') +import Demo +from Person_pb2 import Person + +def menu(): + print """ +usage: +t: send greeting +s: shutdown server +x: exit +?: help +""" + +class Client(Ice.Application): + def run(self, args): + if len(args) > 1: + print self.appName() + ": too many arguments" + return 1 + + hello = Demo.HelloPrx.checkedCast(self.communicator().propertyToProxy('Hello.Proxy')) + if not hello: + print args[0] + ": invalid proxy" + return 1 + + menu() + + p = Person() + p.id = 1 + p.name = "Fred Jones" + p.email = "fred@jones.com" + + c = None + while c != 'x': + try: + c = raw_input("==> ") + if c == 't': + hello.sayHello(p) + elif c == 's': + hello.shutdown() + elif c == 'x': + pass # Nothing to do + elif c == '?': + menu() + else: + print "unknown command `" + c + "'" + menu() + except KeyboardInterrupt: + break + except EOFError: + break + except Ice.Exception, ex: + print ex + + return 0 + +app = Client() +sys.exit(app.main(sys.argv, "config.client")) diff --git a/protobuf/demo/python/Hello.ice b/protobuf/demo/python/Hello.ice new file mode 100644 index 00000000000..418a12b8e55 --- /dev/null +++ b/protobuf/demo/python/Hello.ice @@ -0,0 +1,28 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +module Demo +{ + +["python:protobuf:Person_pb2.Person"] sequence<byte> Person; + +interface Hello +{ + idempotent void sayHello(Person p); + void shutdown(); +}; + +}; + + +#endif diff --git a/protobuf/demo/python/Person.proto b/protobuf/demo/python/Person.proto new file mode 100644 index 00000000000..c512c800570 --- /dev/null +++ b/protobuf/demo/python/Person.proto @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +package tutorial; + +message Person { + required int32 id = 1; + required string name = 2; + optional string email = 3; +} diff --git a/protobuf/demo/python/Person_pb2.py b/protobuf/demo/python/Person_pb2.py new file mode 100644 index 00000000000..5cde5d220b0 --- /dev/null +++ b/protobuf/demo/python/Person_pb2.py @@ -0,0 +1,71 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: Person.proto + +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='Person.proto', + package='tutorial', + serialized_pb='\n\x0cPerson.proto\x12\x08tutorial\"1\n\x06Person\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\r\n\x05\x65mail\x18\x03 \x01(\t') + + + + +_PERSON = _descriptor.Descriptor( + name='Person', + full_name='tutorial.Person', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='tutorial.Person.id', index=0, + number=1, type=5, cpp_type=1, label=2, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='tutorial.Person.name', index=1, + number=2, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=unicode("", "utf-8"), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='email', full_name='tutorial.Person.email', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=unicode("", "utf-8"), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=26, + serialized_end=75, +) + +DESCRIPTOR.message_types_by_name['Person'] = _PERSON + +class Person(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _PERSON + + # @@protoc_insertion_point(class_scope:tutorial.Person) + + +# @@protoc_insertion_point(module_scope) diff --git a/protobuf/demo/python/README b/protobuf/demo/python/README new file mode 100644 index 00000000000..a71cc17b2e3 --- /dev/null +++ b/protobuf/demo/python/README @@ -0,0 +1,50 @@ +Introduction +------------ + +This demo shows how to integrate Google Protocol Buffers with Ice. + +The Protocol Buffers distribution and documentation can be found at + + http://code.google.com/apis/protocolbuffers/ + +This demo was tested with Protocol Buffers version 2.5.0. + +Ice supports metadata that makes it possible for you to specify +Protocol Buffers message types in your Slice definitions, with Ice +handling the serialization chores for you automatically. The metadata, +which may only be used on a sequence<byte> type, has the following +syntax in Python: + + python:protobuf:protoc-generated-class + +For example: + + ["python:protobuf:Person_pb2.Person"] sequence<byte> Person; + +The type name specified in this example, Person_pb2.Person, +corresponds to the Python class generated by the Protocol Buffers +compiler (protoc) for the definition shown below: + + package tutorial; + message Person { ... }; + +Prior to running the demo, you must generate the Python code for +Person.proto by running the following command: + + $ protoc --python_out=. Person.proto + + +Running the demo +---------------- + +First you must ensure that your environment is set up to run Ice +applications. Please see the documentation that came with your Ice +distribution for more information. + +To run the demo, first start the server: + + $ python Server.py + +In a separate window, start the client: + + $ python Client.py diff --git a/protobuf/demo/python/Server.py b/protobuf/demo/python/Server.py new file mode 100644 index 00000000000..8973effcd95 --- /dev/null +++ b/protobuf/demo/python/Server.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import sys, traceback, time, Ice + +Ice.loadSlice('Hello.ice') +import Demo +from Person_pb2 import Person + +class HelloI(Demo.Hello): + def sayHello(self, p, current=None): + print "Hello World from %s" % str(p) + + def shutdown(self, current=None): + current.adapter.getCommunicator().shutdown() + +class Server(Ice.Application): + def run(self, args): + if len(args) > 1: + print self.appName() + ": too many arguments" + return 1 + + adapter = self.communicator().createObjectAdapter("Hello") + adapter.add(HelloI(), self.communicator().stringToIdentity("hello")) + adapter.activate() + self.communicator().waitForShutdown() + return 0 + +sys.stdout.flush() +app = Server() +sys.exit(app.main(sys.argv, "config.server")) diff --git a/protobuf/demo/python/config.client b/protobuf/demo/python/config.client new file mode 100644 index 00000000000..a02cab0f4cb --- /dev/null +++ b/protobuf/demo/python/config.client @@ -0,0 +1,23 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/demo/python/config.server b/protobuf/demo/python/config.server new file mode 100644 index 00000000000..309db9731b2 --- /dev/null +++ b/protobuf/demo/python/config.server @@ -0,0 +1,24 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/protobuf/fixProtobufCopyright.py b/protobuf/fixProtobufCopyright.py new file mode 100755 index 00000000000..6920a7bd303 --- /dev/null +++ b/protobuf/fixProtobufCopyright.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import os, sys, FixUtil + +def usage(): + print "Usage: " + sys.argv[0] + " [options]" + print + print "Options:" + print "-h Show this message." + print + +for x in sys.argv[1:]: + if x == "-h": + usage() + sys.exit(0) + elif x.startswith("-"): + print sys.argv[0] + ": unknown option `" + x + "'" + print + usage() + sys.exit(1) + +ice_dir = os.path.normpath(os.path.join(os.path.dirname(__file__))) + +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** +for dir in ["."]: + home = os.path.join(ice_dir, dir) + if home: + FixUtil.replaceAllCopyrights(home, "Ice Protobuf", "ICE_PROTOBUF_LICENSE", True) + +# +# Fix various other files that have copyright info in them that +# are not taken care of above. +# +cpatMatch = "20[0-9][0-9]-(20[0-9][0-9]) ZeroC" +copyright = "2013" + +files = [os.path.join(ice_dir, ".", "ICE_PROTOBUF_LICENSE")] + +for f in files: + FixUtil. fileMatchAndReplace(f, [(cpatMatch, copyright)]) diff --git a/protobuf/test/cpp/.depend b/protobuf/test/cpp/.depend new file mode 100644 index 00000000000..43c27dd1f6a --- /dev/null +++ b/protobuf/test/cpp/.depend @@ -0,0 +1,9 @@ +Test$(OBJEXT): Test.cpp Test.h Test.pb.h StreamProtobuf.h +Client$(OBJEXT): Client.cpp ../../../cpp/test/include/TestCommon.h Test.h Test.pb.h StreamProtobuf.h +AllTests$(OBJEXT): AllTests.cpp ../../../cpp/test/include/TestCommon.h Test.h Test.pb.h StreamProtobuf.h +Test.pb$(OBJEXT): Test.pb.cpp Test.pb.h +Test$(OBJEXT): Test.cpp Test.h Test.pb.h StreamProtobuf.h +TestI$(OBJEXT): TestI.cpp TestI.h Test.h Test.pb.h StreamProtobuf.h +Server$(OBJEXT): Server.cpp TestI.h Test.h Test.pb.h StreamProtobuf.h +Test.pb$(OBJEXT): Test.pb.cpp Test.pb.h +Test.pb.cpp: Test.proto diff --git a/protobuf/test/cpp/.depend.mak b/protobuf/test/cpp/.depend.mak new file mode 100644 index 00000000000..e2ab71b2594 --- /dev/null +++ b/protobuf/test/cpp/.depend.mak @@ -0,0 +1,8 @@ +Test$(OBJEXT): Test.cpp Test.h Test.pb.h StreamProtobuf.h +Client$(OBJEXT): Client.cpp ../../../cpp/test/include/TestCommon.h Test.h Test.pb.h StreamProtobuf.h +AllTests$(OBJEXT): AllTests.cpp ../../../cpp/test/include/TestCommon.h Test.h Test.pb.h StreamProtobuf.h +Test.pb$(OBJEXT): Test.pb.cpp Test.pb.h +Test$(OBJEXT): Test.cpp Test.h Test.pb.h StreamProtobuf.h +TestI$(OBJEXT): TestI.cpp TestI.h Test.h Test.pb.h StreamProtobuf.h +Server$(OBJEXT): Server.cpp TestI.h Test.h Test.pb.h StreamProtobuf.h +Test.pb$(OBJEXT): Test.pb.cpp Test.pb.h diff --git a/protobuf/test/cpp/.gitignore b/protobuf/test/cpp/.gitignore new file mode 100644 index 00000000000..0a8a5d76820 --- /dev/null +++ b/protobuf/test/cpp/.gitignore @@ -0,0 +1,10 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Test.cpp +Test.h +Test.pb.cpp +Test.pb.h + diff --git a/protobuf/test/cpp/AllTests.cpp b/protobuf/test/cpp/AllTests.cpp new file mode 100644 index 00000000000..10c7322fe87 --- /dev/null +++ b/protobuf/test/cpp/AllTests.cpp @@ -0,0 +1,145 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> +#include <Test.pb.h> + +using namespace std; +using namespace Test; + +class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex> +{ +public: + + CallbackBase() : + _called(false) + { + } + + virtual ~CallbackBase() + { + } + + void check() + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_called) + { + wait(); + } + _called = false; + } + +protected: + + void called() + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_called); + _called = true; + notify(); + } + +private: + + bool _called; +}; + +class AMI_MyClass_opMessageI : public Test::AMI_MyClass_opMessage, public CallbackBase +{ +public: + + virtual void ice_response(const test::Message& r, const test::Message& o) + { + test(o.i() == 99); + test(r.i() == 99); + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; +typedef IceUtil::Handle<AMI_MyClass_opMessageI> AMI_MyClass_opMessageIPtr; + +class AMI_MyClass_opMessageAMDI : public Test::AMI_MyClass_opMessageAMD, public CallbackBase +{ +public: + + virtual void ice_response(const test::Message& r, const test::Message& o) + { + test(o.i() == 99); + test(r.i() == 99); + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; +typedef IceUtil::Handle<AMI_MyClass_opMessageAMDI> AMI_MyClass_opMessageAMDIPtr; + + +MyClassPrx +allTests(const Ice::CommunicatorPtr& communicator) +{ + string ref = "test:default -p 12010"; + Ice::ObjectPrx baseProxy = communicator->stringToProxy(ref); + MyClassPrx cl = MyClassPrx::checkedCast(baseProxy); + test(cl); + + cout << "testing twoway operations... " << flush; + { + test::Message i; + i.set_i(99); + test::Message o; + + test::Message r = cl->opMessage(i, o); + + test(o.i() == 99); + test(r.i() == 99); + } + { + test::Message i; + i.set_i(99); + test::Message o; + + test::Message r = cl->opMessageAMD(i, o); + + test(o.i() == 99); + test(r.i() == 99); + } + cout << "ok" << endl; + + cout << "testing twoway AMI operations... " << flush; + { + test::Message i; + i.set_i(99); + + AMI_MyClass_opMessageIPtr cb = new AMI_MyClass_opMessageI(); + cl->opMessage_async(cb, i); + cb->check(); + } + { + test::Message i; + i.set_i(99); + + AMI_MyClass_opMessageAMDIPtr cb = new AMI_MyClass_opMessageAMDI(); + cl->opMessageAMD_async(cb, i); + cb->check(); + } + cout << "ok" << endl; + + return cl; +} diff --git a/protobuf/test/cpp/Client.cpp b/protobuf/test/cpp/Client.cpp new file mode 100644 index 00000000000..084509d7b6a --- /dev/null +++ b/protobuf/test/cpp/Client.cpp @@ -0,0 +1,71 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; +using namespace Test; + +int +run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) +{ + MyClassPrx allTests(const Ice::CommunicatorPtr&); + MyClassPrx myClass = allTests(communicator); + myClass->shutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + + // + // For this test, we want to disable retries. + // + initData.properties->setProperty("Ice.RetryIntervals", "-1"); + + // + // This test kills connections, so we don't want warnings. + // + initData.properties->setProperty("Ice.Warn.Connections", "0"); + + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if(communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/protobuf/test/cpp/Makefile b/protobuf/test/cpp/Makefile new file mode 100644 index 00000000000..9fd72a3a6b2 --- /dev/null +++ b/protobuf/test/cpp/Makefile @@ -0,0 +1,68 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# If protobuf is not installed in a standard location where the +# compiler can find it, set PROTOBUF_HOME to the protobuf installation +# directory. +# +PROTOBUF_HOME ?= /usr/local + +top_srcdir = ../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +COBJS = Test.o \ + Client.o \ + AllTests.o \ + Test.pb.o + +SOBJS = Test.o \ + TestI.o \ + Server.o \ + Test.pb.o + +SRCS = $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +SLICE_SRCS = Test.ice +PROTO_SRCS = Test.proto + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := $(ICE_FLAGS) -I. -I../../../cpp/test/include -I$(PROTOBUF_HOME)/include $(CPPFLAGS) +LIBS := $(ICE_LIB_DIR) $(LIBS) -L$(PROTOBUF_HOME)/lib -lprotobuf + +$(CLIENT): $(COBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(LIBS) + +$(SERVER): $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(SOBJS) $(LIBS) + +%..pb.h %.pb.cpp: %.proto + rm -f $(*F).pb.h $(*F).pb.cpp + $(PROTOBUF_HOME)/bin/protoc --cpp_out=. $(*F).proto + mv $(*F).pb.cc $(*F).pb.cpp + +depend:: + for i in $(PROTO_SRCS); do \ + echo "$${i%.proto}.pb.cpp: $$i" >> .depend; \ + done + +clean:: + rm -f $(addsuffix .pb.cpp, $(basename $(notdir $(PROTO_SRCS)))) + rm -f $(addsuffix .pb.h, $(basename $(notdir $(PROTO_SRCS)))) + +include .depend diff --git a/protobuf/test/cpp/Makefile.mak b/protobuf/test/cpp/Makefile.mak new file mode 100644 index 00000000000..b40fb8517a3 --- /dev/null +++ b/protobuf/test/cpp/Makefile.mak @@ -0,0 +1,77 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +# +# If protobuf is not installed in a standard location where the +# compiler can find it, set PROTOBUF_HOME to the protobuf installation +# directory. +# +!if "$(PROTOBUF_HOME)" == "" +PROTOBUF_HOME = c:\protobuf +!endif + +top_srcdir = ..\.. + +CLIENT = client.exe +SERVER = server.exe + +TARGETS = $(CLIENT) $(SERVER) + +COBJS = Test.obj \ + Client.obj \ + AllTests.obj \ + Test.pb.obj + +SOBJS = Test.obj \ + TestI.obj \ + Server.obj \ + Test.pb.obj + +SRCS = $(COBJS:.obj=.cpp) \ + $(SOBJS:.obj=.cpp) + +!include $(top_srcdir)/config/Make.rules.mak + +# +# Need to use -W0 to get rid of ugly warnings from generated protobuf file as +# well as prevent compile failure on x64 due to warnings from protobuf headers +# +CPPFLAGS = $(ICE_CPPFLAGS) -I$(PROTOBUF_HOME)\include -I. -I../../../cpp/test/include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN #-W0 +LIBS = $(ICE_LDFLAGS) $(LIBS) /libpath:$(PROTOBUF_HOME)\lib libprotobuf$(LIBSUFFIX).lib + +!if "$(GENERATE_PDB)" == "yes" +CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) +SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb) +!endif + +$(CLIENT): $(COBJS) + $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +$(SERVER): $(SOBJS) + $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +# A generic rule would be nicer, but since protoc generates .pb.cpp +# it is not possible with nmake. +Test.pb.cpp: Test.proto + del /q Test.pb.h Test.pb.cpp + $(PROTOBUF_HOME)\bin\protoc --cpp_out=. Test.proto + move Test.pb.cc Test.pb.cpp + +Test.pb.h: Test.pb.cpp + +clean:: + del /q Test.pb.h Test.pb.cpp + del /q Test.cpp Test.h + +!include .depend diff --git a/protobuf/test/cpp/Server.cpp b/protobuf/test/cpp/Server.cpp new file mode 100644 index 00000000000..61ee8b830a7 --- /dev/null +++ b/protobuf/test/cpp/Server.cpp @@ -0,0 +1,67 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +int +run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) +{ + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); + Ice::ObjectPtr object = new MyClassI; + adapter->add(object, communicator->stringToIdentity("test")); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + + // + // This test kills connections, so we don't want warnings. + // + initData.properties->setProperty("Ice.Warn.Connections", "0"); + + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if(communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/protobuf/test/cpp/StreamProtobuf.h b/protobuf/test/cpp/StreamProtobuf.h new file mode 100644 index 00000000000..ff2bfd665a9 --- /dev/null +++ b/protobuf/test/cpp/StreamProtobuf.h @@ -0,0 +1,99 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef STREAM_PROTOBUF_H +#define STREAM_PROTOBUF_H + +#include <Ice/Ice.h> +#include <google/protobuf/message_lite.h> + +#ifdef ICE_CPP11 +#include <type_traits> +#endif + +// +// Tell Ice how to marshal and unmarshal a protobuf message to/from a sequence<byte> +// +namespace Ice +{ + +#ifdef ICE_CPP11 +// +// We'll use std::enable_if to give protobuf its own helper category (see below) +// +const StreamHelperCategory StreamHelperCategoryProtobuf = 100; +#else +// +// We just assume a single "custom" category: Unknown +// +const StreamHelperCategory StreamHelperCategoryProtobuf = StreamHelperCategoryUnknown; +#endif + +#ifdef ICE_CPP11 + +template<typename T> +struct StreamableTraits<T, typename std::enable_if<std::is_base_of< ::google::protobuf::MessageLite, T>::value >::type> +{ + static const StreamHelperCategory helper = StreamHelperCategoryProtobuf; + static const int minWireSize = 1; + static const bool fixedLength = false; +}; + +#else +// +// We use the default 'Unknown' StreamHelperCategory +// +#endif + +template<typename T> +struct StreamHelper<T, StreamHelperCategoryProtobuf> +{ + template<class S> static inline void + write(S* stream, const ::google::protobuf::MessageLite& v) + { + std::vector<Byte> data(v.ByteSize()); + if(!v.IsInitialized()) + { + throw MarshalException(__FILE__, __LINE__, + "message not fully initialized: " + v.InitializationErrorString()); + } + + Byte* r = v.SerializeWithCachedSizesToArray(&data[0]); + if(r != &data[0] + data.size()) + { + throw MarshalException(__FILE__, __LINE__, "message modified during marshaling"); + } + + stream->write(&data[0], &data[0] + data.size()); + } + + template<class S> static inline void + read(S* stream, ::google::protobuf::MessageLite& v) + { + std::pair<const Byte*, const Byte*> data; + stream->read(data); + if(!v.ParseFromArray(data.first, static_cast<int>(data.second - data.first))) + { + throw MarshalException(__FILE__, __LINE__, "ParseFromArray failed"); + } + } +}; + +// +// Use default marshaling/unmarshaling, with optionalFormat = OptionalFormatVSize +// +template<> +struct GetOptionalFormat<StreamHelperCategoryProtobuf, 1, false> +{ + static const OptionalFormat value = OptionalFormatVSize; +}; + +} +#endif diff --git a/protobuf/test/cpp/Test.ice b/protobuf/test/cpp/Test.ice new file mode 100644 index 00000000000..169040c48be --- /dev/null +++ b/protobuf/test/cpp/Test.ice @@ -0,0 +1,63 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +[["cpp:include:Test.pb.h"]] +[["cpp:include:StreamProtobuf.h"]] + +module Test +{ + +["cpp:type:test::Message"] sequence<byte> Message; + +["ami"] class MyClass +{ + void shutdown(); + + Message opMessage(Message i, out Message o); + + ["amd"] Message opMessageAMD(Message i, out Message o); +}; + +// Remaining type definitions are there to verify that the generated +// code compiles correctly. + +sequence<Message> SLS; +sequence<SLS> SLSS; +dictionary<int, Message> SLD; +dictionary<int, SLS> SLSD; + +// +// The following doesn't compile since the generated protobuf type +// doesn't define operator== or operator< +// +// struct Foo +// { +// Message SLmem; +// SLS SLSmem; +// }; + +exception Bar +{ + Message SLmem; + SLS SLSmem; +}; + +class Baz +{ + Message SLmem; + SLS SLSmem; +}; + +}; + +#endif diff --git a/protobuf/test/cpp/Test.proto b/protobuf/test/cpp/Test.proto new file mode 100644 index 00000000000..29e8ec3c165 --- /dev/null +++ b/protobuf/test/cpp/Test.proto @@ -0,0 +1,16 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test; + +option java_outer_classname = "TestPB"; + +message Message { + required int32 i = 1; +} diff --git a/protobuf/test/cpp/TestI.cpp b/protobuf/test/cpp/TestI.cpp new file mode 100644 index 00000000000..d51e54ed46b --- /dev/null +++ b/protobuf/test/cpp/TestI.cpp @@ -0,0 +1,34 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#include <TestI.h> +#include <Ice/Ice.h> + +using namespace std; +using namespace Ice; + +test::Message +MyClassI::opMessage(const test::Message& i, test::Message& o, const Ice::Current&) +{ + o = i; + return i; +} + +void +MyClassI::opMessageAMD_async(const Test::AMD_MyClass_opMessageAMDPtr& cb, const test::Message& i, const Ice::Current&) +{ + cb->ice_response(i, i); +} + +void +MyClassI::shutdown(const Ice::Current& current) +{ + current.adapter->getCommunicator()->shutdown(); +} diff --git a/protobuf/test/cpp/TestI.h b/protobuf/test/cpp/TestI.h new file mode 100644 index 00000000000..4aed352bcac --- /dev/null +++ b/protobuf/test/cpp/TestI.h @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class MyClassI : virtual public Test::MyClass +{ +public: + + virtual void shutdown(const Ice::Current&); + + virtual test::Message opMessage(const test::Message&, test::Message&, const Ice::Current&); + virtual void opMessageAMD_async(const Test::AMD_MyClass_opMessageAMDPtr&, const test::Message&, + const Ice::Current&); +}; + +#endif diff --git a/protobuf/test/cpp/run.py b/protobuf/test/cpp/run.py new file mode 100755 index 00000000000..2e3d6b2bcf4 --- /dev/null +++ b/protobuf/test/cpp/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import os, sys + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil + +TestUtil.clientServerTest() diff --git a/protobuf/test/java/AllTests.java b/protobuf/test/java/AllTests.java new file mode 100644 index 00000000000..48d6e02db61 --- /dev/null +++ b/protobuf/test/java/AllTests.java @@ -0,0 +1,156 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +public class AllTests +{ + private static void + test(boolean b) + { + if(!b) + { + throw new RuntimeException(); + } + } + + private static class Callback + { + Callback() + { + _called = false; + } + + public synchronized void + check() + { + while(!_called) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + + _called = false; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; + } + + private static class AMI_MyClass_opMessage extends Test.AMI_MyClass_opMessage + { + public void + ice_response(test.TestPB.Message r, test.TestPB.Message o) + { + test(o.getI() == 99); + test(r.getI() == 99); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + private static class AMI_MyClass_opMessageAMD extends Test.AMI_MyClass_opMessageAMD + { + public void + ice_response(test.TestPB.Message r, test.TestPB.Message o) + { + test(o.getI() == 99); + test(r.getI() == 99); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + public static Test.MyClassPrx + allTests(Ice.Communicator communicator, boolean collocated) + { + String ref = "test:default -p 12010"; + Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); + Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); + + System.out.print("testing twoway operations... "); + { + test.TestPB.Message i = test.TestPB.Message.newBuilder().setI(99).build(); + Ice.Holder<test.TestPB.Message> o = new Ice.Holder<test.TestPB.Message>(); + test.TestPB.Message r; + + r = cl.opMessage(i, o); + + test(o.value.getI() == 99); + test(r.getI() == 99); + } + { + test.TestPB.Message i = test.TestPB.Message.newBuilder().setI(99).build(); + Ice.Holder<test.TestPB.Message> o = new Ice.Holder<test.TestPB.Message>(); + test.TestPB.Message r; + + r = cl.opMessageAMD(i, o); + + test(o.value.getI() == 99); + test(r.getI() == 99); + } + System.out.println("ok"); + + System.out.print("testing twoway AMI operations... "); + { + test.TestPB.Message i = test.TestPB.Message.newBuilder().setI(99).build(); + + AMI_MyClass_opMessage cb = new AMI_MyClass_opMessage(); + cl.opMessage_async(cb, i); + cb.check(); + } + { + test.TestPB.Message i = test.TestPB.Message.newBuilder().setI(99).build(); + + AMI_MyClass_opMessageAMD cb = new AMI_MyClass_opMessageAMD(); + cl.opMessageAMD_async(cb, i); + cb.check(); + } + System.out.println("ok"); + + return cl; + } +} diff --git a/protobuf/test/java/Client.java b/protobuf/test/java/Client.java new file mode 100644 index 00000000000..bdd232e91e7 --- /dev/null +++ b/protobuf/test/java/Client.java @@ -0,0 +1,54 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +public class Client +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + myClass.shutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch(Exception ex) + { + ex.printStackTrace(); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.gc(); + System.exit(status); + } +} diff --git a/protobuf/test/java/MyClassI.java b/protobuf/test/java/MyClassI.java new file mode 100644 index 00000000000..a6ccbc5dca2 --- /dev/null +++ b/protobuf/test/java/MyClassI.java @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +public final class MyClassI extends Test.MyClass +{ + private static void + test(boolean b) + { + if(!b) + { + throw new RuntimeException(); + } + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + + public test.TestPB.Message opMessage(test.TestPB.Message i, Ice.Holder<test.TestPB.Message> o, Ice.Current current) + { + o.value = i; + return i; + } + + public void opMessageAMD_async(Test.AMD_MyClass_opMessageAMD amdCB, test.TestPB.Message i, Ice.Current current) + { + amdCB.ice_response(i, i); + } +} diff --git a/protobuf/test/java/Server.java b/protobuf/test/java/Server.java new file mode 100644 index 00000000000..c01a0dbb86f --- /dev/null +++ b/protobuf/test/java/Server.java @@ -0,0 +1,58 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +public class Server +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new MyClassI(), communicator.stringToIdentity("test")); + adapter.activate(); + + communicator.waitForShutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch(Exception ex) + { + ex.printStackTrace(); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.gc(); + System.exit(status); + } +} diff --git a/protobuf/test/java/Test.ice b/protobuf/test/java/Test.ice new file mode 100644 index 00000000000..bbc3f5b3d38 --- /dev/null +++ b/protobuf/test/java/Test.ice @@ -0,0 +1,55 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module Test +{ + +["java:protobuf:test.TestPB.Message"] sequence<byte> Message; + +["ami"] class MyClass +{ + void shutdown(); + + Message opMessage(Message i, out Message o); + + ["amd"] Message opMessageAMD(Message i, out Message o); +}; + +// Remaining type definitions are there to verify that the generated +// code compiles correctly. + +sequence<Message> SLS; +sequence<SLS> SLSS; +dictionary<int, Message> SLD; +dictionary<int, SLS> SLSD; +struct Foo +{ + Message SLmem; + SLS SLSmem; +}; + +exception Bar +{ + Message SLmem; + SLS SLSmem; +}; + +class Baz +{ + Message SLmem; + SLS SLSmem; +}; + +}; + +#endif diff --git a/protobuf/test/java/Test.proto b/protobuf/test/java/Test.proto new file mode 100644 index 00000000000..29e8ec3c165 --- /dev/null +++ b/protobuf/test/java/Test.proto @@ -0,0 +1,16 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test; + +option java_outer_classname = "TestPB"; + +message Message { + required int32 i = 1; +} diff --git a/protobuf/test/java/ant/ProtocTask.java b/protobuf/test/java/ant/ProtocTask.java new file mode 100644 index 00000000000..2c52bf3b37d --- /dev/null +++ b/protobuf/test/java/ant/ProtocTask.java @@ -0,0 +1,371 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +//package Ice.Ant; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.taskdefs.ExecTask; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.PumpStreamHandler; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.Commandline.Argument; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Reference; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.StringReader; +import java.io.BufferedReader; +import java.io.BufferedWriter; + +/** + * An ant task for protoc. + * + * Attributes specific to protoc: + * + * translator - The pathname of the translator (default: "protoc"). + * protocpath - The value for the --proto_path translator option. + * outputdir - The value for the --java_out translator option. + * dependencyfile - The file in which dependencies are stored (default: ".pbdepend"). + * + * Example: + * + * <project ...> + * <taskdef name="protoc" classname="ProtocTask" /> + * <property name="protoc.dir" value="../include/protoc"/> + * <target name="generate"> + * <mkdir dir="tags" /> + * <protoc tagdir="tags" outputdir="out"> + * <fileset dir="${protoc.dir}"> + * <include name="*.ice" /> + * </fileset> + * </protoc> + * </target> + * </project> + * + * The <taskdef> element installs the protoctask task. + */ +public class ProtocTask extends org.apache.tools.ant.Task +{ + public + ProtocTask() + { + _translator = null; + _outputDir = null; + _protocPath = null; + _outputDirString = null; + } + + public void + setDependencyFile(File file) + { + _dependencyFile = file; + } + + public void + setOutputdir(File dir) + { + _outputDir = dir; + _outputDirString = _outputDir.toString(); + if(_outputDirString.indexOf(' ') != -1) + { + _outputDirString = '"' + _outputDirString + '"'; + } + } + + public void + setProtocpath(File dir) + { + _protocPath = dir.toString(); + } + + public void + setTranslator(File prog) + { + _translator = prog; + } + + public FileSet + createFileset() + { + FileSet fileset = new FileSet(); + _fileSets.add(fileset); + + return fileset; + } + + @SuppressWarnings("unchecked") + public void + execute() + throws BuildException + { + if(_fileSets.isEmpty()) + { + throw new BuildException("No fileset specified"); + } + + // + // Read the set of dependencies for this task. + // + java.util.HashMap dependencies = readDependencies(); + + // + // Compose a list of the files that need to be translated. A + // file needs to translated if we can't find a dependency in + // the dependency table or if its dependency is not up-to-date + // anymore (the proto file changed since the dependency was + // last updated) + // + java.util.Vector<File> buildList = new java.util.Vector<File>(); + java.util.Vector<File> skipList = new java.util.Vector<File>(); + java.util.Iterator p = _fileSets.iterator(); + while(p.hasNext()) + { + FileSet fileset = (FileSet)p.next(); + + DirectoryScanner scanner = fileset.getDirectoryScanner(getProject()); + scanner.scan(); + String[] files = scanner.getIncludedFiles(); + for(int i = 0; i < files.length; i++) + { + File proto = new File(fileset.getDir(getProject()), files[i]); + + ProtoDependency depend = (ProtoDependency)dependencies.get(getTargetKey(proto.toString())); + if(depend == null || !depend.isUpToDate()) + { + buildList.addElement(proto); + } + else + { + skipList.addElement(proto); + } + } + + java.util.Iterator i = skipList.iterator(); + while(i.hasNext()) + { + File file = (File)i.next(); + log("skipping " + file.getName()); + } + } + + // + // Run the translator + // + if(!buildList.isEmpty()) + { + String translator; + if(_translator == null) + { + translator = "protoc"; + } + else + { + translator = _translator.toString(); + } + + StringBuilder cmd = new StringBuilder(128); + + // + // Add --java_out. + // + if(_outputDir != null) + { + cmd.append(" --java_out="); + cmd.append(stripDriveLetter(_outputDirString)); + } + + // + // Add --proto_path + // + if(_protocPath != null) + { + cmd.append(" --proto_path="); + cmd.append(stripDriveLetter(_protocPath)); + } + + // + // Add files to be translated + // + for(int i = 0; i < buildList.size(); i++) + { + File f = (File)buildList.elementAt(i); + cmd.append(" "); + String s = stripDriveLetter(f.toString()); + if(s.indexOf(' ') != -1) + { + cmd.append('"'); + cmd.append(s); + cmd.append('"'); + } + else + { + cmd.append(s); + } + } + + // + // Execute + // + log(translator + " " + cmd); + ExecTask task = (ExecTask)getProject().createTask("exec"); + task.setFailonerror(true); + Argument arg = task.createArg(); + arg.setLine(cmd.toString()); + task.setExecutable(translator); + task.execute(); + + // + // Update dependency file. + // + for(int i = 0; i < buildList.size(); i++) + { + ProtoDependency depend = new ProtoDependency(); + depend._timeStamp = new java.util.Date().getTime(); + depend._dependency = ((File)buildList.elementAt(i)).toString(); + dependencies.put(getTargetKey(depend._dependency), depend); + } + + writeDependencies(dependencies); + } + } + + private String + getTargetKey(String proto) + { + // + // Since the dependency file can be shared by several proto + // tasks we need to make sure that each dependency has a + // unique key. We use the name of the task, the output + // directory and the name of the proto file to be compiled. + // + // If there's two protoc tasks using the same dependency + // file, with the same output dir and which compiles the same + // protoc file they'll use the same dependency. + // + return "protoc " + _outputDir.toString() + " " + proto; + } + + // This is to work around a bug with protoc, where it does not + // accept drive letters in path names. See + // http://bugzilla/bugzilla/show_bug.cgi?id=3349 + // + private String + stripDriveLetter(String s) + { + if(s.length() > 1 && s.charAt(1) == ':') + { + return s.substring(2); + } + return s; + } + + // + // Read the dependency file. + // + private java.util.HashMap + readDependencies() + { + if(_dependencyFile == null) + { + if(_outputDir != null) + { + _dependencyFile = new File(_outputDir, ".pbdepend"); + } + else + { + _dependencyFile = new File(".pbdepend"); + } + } + + try + { + java.io.ObjectInputStream in = new java.io.ObjectInputStream(new java.io.FileInputStream(_dependencyFile)); + java.util.HashMap dependencies = (java.util.HashMap)in.readObject(); + in.close(); + return dependencies; + } + catch(java.io.IOException ex) + { + } + catch(java.lang.ClassNotFoundException ex) + { + } + + return new java.util.HashMap(); + } + + private void + writeDependencies(java.util.HashMap dependencies) + { + try + { + java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(new FileOutputStream(_dependencyFile)); + out.writeObject(dependencies); + out.close(); + } + catch(java.io.IOException ex) + { + throw new BuildException("Unable to write dependencies in file " + _dependencyFile.getPath() + ": " + ex); + } + } + + // + // A proto dependency. + // + // * the _timeStamp attribute contains the last time the proto + // file was compiled. + // + // * the _dependency attribute contains the .proto file. + // + private class ProtoDependency implements java.io.Serializable + { + private void writeObject(java.io.ObjectOutputStream out) + throws java.io.IOException + { + out.writeObject(_dependency); + out.writeLong(_timeStamp); + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException + { + _dependency = (String)in.readObject(); + _timeStamp = in.readLong(); + } + + public boolean + isUpToDate() + { + File dep = new File(_dependency); + if(!dep.exists() || _timeStamp < dep.lastModified()) + { + return false; + } + + return true; + } + + public String _dependency; + public long _timeStamp; + } + + private File _translator; + private File _dependencyFile; + private File _outputDir; + private String _outputDirString; + private String _protocPath; + private java.util.List<FileSet> _fileSets = new java.util.LinkedList<FileSet>(); +} diff --git a/protobuf/test/java/build.xml b/protobuf/test/java/build.xml new file mode 100644 index 00000000000..9ac305bfe1e --- /dev/null +++ b/protobuf/test/java/build.xml @@ -0,0 +1,69 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. + + This copy of Ice Protobuf is licensed to you under the terms described + in the ICE_PROTOBUF_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="test_java" default="all" basedir="."> + + <!-- set global properties for this build --> + <property name="top.dir" value="../.."/> + + <!-- import common definitions --> + <import file="${top.dir}/config/common.xml"/> + + <target name="protoc" depends="init"> + <!-- Build protoc task --> + <mkdir dir="${class.dir}"/> + <javac srcdir="ant" destdir="${class.dir}" debug="${debug}"> + <!--compilerarg value="${javac.lint}"/--> + <compilerarg value="-Xlint:unchecked"/> + </javac> + </target> + + <target name="generate" depends="protoc"> + <!-- Add the protoc task --> + <taskdef name="protoc" classpath="${class.dir}" classname="ProtocTask" /> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}"> + <meta value="${java2metadata}"/> + <fileset dir="." includes="Test.ice"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + </slice2java> + <protoc outputdir="${generated.dir}" protocpath="."> + <fileset dir="." includes="Test.proto"/> + </protoc> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir="." destdir="${class.dir}" includes="Serialize/**" + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + <javac srcdir="${generated.dir}" destdir="${class.dir}" + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + <javac srcdir="." destdir="${class.dir}" + classpathref="ice.classpath" excludes="generated/**,Serialize/**" debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="all" depends="compile"/> + + <target name="clean"> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + </target> + +</project> diff --git a/protobuf/test/java/run.py b/protobuf/test/java/run.py new file mode 100755 index 00000000000..b329edb67ff --- /dev/null +++ b/protobuf/test/java/run.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import os, sys + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil + +if "CLASSPATH" in os.environ: + os.environ["CLASSPATH"] = os.environ["CLASSPATH"] + os.pathsep + "classes" +else: + os.environ["CLASSPATH"] = "classes" + +TestUtil.clientServerTest() diff --git a/protobuf/test/py/AllTests.py b/protobuf/test/py/AllTests.py new file mode 100644 index 00000000000..0653c2772fe --- /dev/null +++ b/protobuf/test/py/AllTests.py @@ -0,0 +1,75 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import Ice, Test, threading +from Test_pb2 import Message + +def test(b): + if not b: + raise RuntimeError('test assertion failed') + +class CallbackBase: + def __init__(self): + self._called = False + self._cond = threading.Condition() + + def called(self): + self._cond.acquire() + self._called = True + self._cond.notify() + self._cond.release() + + def check(self): + self._cond.acquire() + while not self._called: + self._cond.wait() + self._called = False + +class AMI_MyClass_opMessageI(CallbackBase): + def ice_response(self, r, o): + test(o.i == 99); + test(r.i == 99); + self.called() + + def ice_exception(self, ex): + test(False) + +def allTests(communicator, collocated): + sref = "test:default -p 12010" + obj = communicator.stringToProxy(sref) + test(obj != None) + + cl = Test.MyClassPrx.checkedCast(obj) + test(cl != None) + + print "testing twoway operations... ", + i = Message() + i.i = 99 + + r, o = cl.opMessage(i); + test(o.i == 99); + test(r.i == 99); + + r, o = cl.opMessageAMD(i); + test(o.i == 99); + test(r.i == 99); + print "ok" + + print "testing twoway AMI operations... ", + cb = AMI_MyClass_opMessageI() + cl.opMessage_async(cb, i) + cb.check() + + cb = AMI_MyClass_opMessageI() + cl.opMessageAMD_async(cb, i) + cb.check() + print "ok" + + return cl diff --git a/protobuf/test/py/Client.py b/protobuf/test/py/Client.py new file mode 100755 index 00000000000..5c16d8b4564 --- /dev/null +++ b/protobuf/test/py/Client.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import os, sys, traceback + +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "config", "Make.rules")): + break +else: + raise "can't find toplevel directory!" + +# +# Get Slice directory. +# +slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) +if not os.path.exists(slice_dir): + print sys.argv[0] + ': Slice directory not found.' + sys.exit(1) + +import Ice +Ice.loadSlice('-I' + slice_dir + ' Test.ice') +import AllTests + +def test(b): + if not b: + raise RuntimeError('test assertion failed') + +def run(args, communicator): + myClass = AllTests.allTests(communicator, False) + myClass.shutdown() + + return True + +try: + initData = Ice.InitializationData() + initData.properties = Ice.createProperties(sys.argv) + communicator = Ice.initialize(sys.argv, initData) + status = run(sys.argv, communicator) +except: + traceback.print_exc() + status = False + +if communicator: + try: + communicator.destroy() + except: + traceback.print_exc() + status = False + +sys.exit(not status) diff --git a/protobuf/test/py/Server.py b/protobuf/test/py/Server.py new file mode 100755 index 00000000000..2c7a6b9b9dc --- /dev/null +++ b/protobuf/test/py/Server.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import os, sys, traceback, time, threading + +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "config", "Make.rules")): + break +else: + raise "can't find toplevel directory!" + +import Ice + +# +# Get Slice directory. +# +slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) +if not os.path.exists(slice_dir): + print sys.argv[0] + ': Slice directory not found.' + sys.exit(1) + +Ice.loadSlice('-I' + slice_dir + ' Test.ice') +import Test +from Test_pb2 import Message + +class MyClassI(Test.MyClass): + def opMessage(self, m, current=None): + return (m, m) + + def opMessageAMD_async(self, cb, m, current=None): + cb.ice_response(m, m); + + def shutdown(self, current=None): + current.adapter.getCommunicator().shutdown() + +def run(args, communicator): + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp") + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(MyClassI(), communicator.stringToIdentity("test")) + adapter.activate() + communicator.waitForShutdown() + return True + +try: + initData = Ice.InitializationData() + initData.properties = Ice.createProperties(sys.argv) + communicator = Ice.initialize(sys.argv, initData) + status = run(sys.argv, communicator) +except: + traceback.print_exc() + status = False + +if communicator: + try: + communicator.destroy() + except: + traceback.print_exc() + status = False + +sys.exit(not status) diff --git a/protobuf/test/py/Test.ice b/protobuf/test/py/Test.ice new file mode 100644 index 00000000000..70421570e21 --- /dev/null +++ b/protobuf/test/py/Test.ice @@ -0,0 +1,55 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice Protobuf is licensed to you under the terms +// described in the ICE_PROTOBUF_LICENSE file included in this +// distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module Test +{ + +["python:protobuf:Test_pb2.Message"] sequence<byte> Message; + +["ami"] class MyClass +{ + void shutdown(); + + Message opMessage(Message i, out Message o); + + ["amd"] Message opMessageAMD(Message i, out Message o); +}; + +// Remaining type definitions are there to verify that the generated +// code compiles correctly. + +sequence<Message> SLS; +sequence<SLS> SLSS; +dictionary<int, Message> SLD; +dictionary<int, SLS> SLSD; +struct Foo +{ + Message SLmem; + SLS SLSmem; +}; + +exception Bar +{ + Message SLmem; + SLS SLSmem; +}; + +class Baz +{ + Message SLmem; + SLS SLSmem; +}; + +}; + +#endif diff --git a/protobuf/test/py/Test.proto b/protobuf/test/py/Test.proto new file mode 100644 index 00000000000..29e8ec3c165 --- /dev/null +++ b/protobuf/test/py/Test.proto @@ -0,0 +1,16 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test; + +option java_outer_classname = "TestPB"; + +message Message { + required int32 i = 1; +} diff --git a/protobuf/test/py/run.py b/protobuf/test/py/run.py new file mode 100755 index 00000000000..da53f032c5a --- /dev/null +++ b/protobuf/test/py/run.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +# +# This copy of Ice Protobuf is licensed to you under the terms +# described in the ICE_PROTOBUF_LICENSE file included in this +# distribution. +# +# ********************************************************************** + +import os, sys + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil + +if os.system("protoc --python_out=. Test.proto") != 0: + print "failed to compile Test.proto" + sys.exit(1) + +TestUtil.clientServerTest() + +# Remove generated protobuf files. +if os.path.exists("Test_pb2.py"): + os.unlink("Test_pb2.py") +if os.path.exists("Test_pb2.pyc"): + os.unlink("Test_pb2.pyc") diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index 6bbe35a032f..45c24174ed9 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -168,8 +168,6 @@ toplevel = path[0] def sanitize(cp): np = "" for p in cp.split(os.pathsep): - if os.path.normpath(p) == "classes": - continue if len(np) > 0: np = np + os.pathsep np = np + p @@ -1007,7 +1005,11 @@ def getDefaultServerFile(): if lang == "py": return "Server.py" if lang in ["java", "javae"]: - return directoryToPackage() + ".Server" + pkg = directoryToPackage() + if len(pkg) > 0: + pkg = pkg + "." + return pkg + "Server" + raise RuntimeError("unknown language") def getDefaultClientFile(lang = None): if lang is None: @@ -1021,7 +1023,11 @@ def getDefaultClientFile(lang = None): if lang == "py": return "Client.py" if lang in ["java", "javae"]: - return directoryToPackage() + ".Client" + pkg = directoryToPackage() + if len(pkg) > 0: + pkg = pkg + "." + return pkg + "Client" + raise RuntimeError("unknown language") def getDefaultCollocatedFile(): lang = getDefaultMapping() |