[REEF-1839] HelloREEF doesn't have instructions to use as a standalone application
This addressed the issue by
* Adding directions on how to use HelloREEF as a standalone application
JIRA: [REEF-1839](https://issues.apache.org/jira/browse/REEF-1839)
This closes #1343
diff --git a/dev/change_version.py b/dev/change_version.py
index ce46ad2..cbe2fee 100644
--- a/dev/change_version.py
+++ b/dev/change_version.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -19,7 +20,7 @@
This script changes versions in every pom.xml and relevant files.
(How to run)
-python change_version <reef_home> <reef_version_for_pom.xml> -s <true or false> (optional) -p
+python change_version <reef_home> <reef_version_for_pom.xml> -s <true or false> (optional) -p
-s option changes value of 'IsSnapshot' in lang/cs/build.props.
If you use the option "-s false", bulid.props changes as,
@@ -82,7 +83,7 @@
while True:
line = f.readline()
- if not line:
+ if not line:
break
changed_str += line
f.close()
@@ -123,7 +124,7 @@
def change_assembly_info_cs(file, new_version):
changed_str = ""
new_version = new_version.split("-")[0] + ".0"
-
+
f = open(file, 'r')
r = re.compile('"(.*?)"')
@@ -146,7 +147,7 @@
f.close()
"""
-Change Version in lang/cs/build.DotNet.props
+Change Version in lang/cs/build.DotNet.props
"""
def change_dotnet_props_cs(file, new_version):
changed_str = ""
@@ -302,6 +303,24 @@
f.write(changed_str)
f.close()
+def change_project_number_readme(file, new_version):
+ changed_str = ""
+
+ markers = ["<Reference", "<HintPath>"]
+ # 0 . 15etc
+ version_regex = re.compile(r'[0-9]\.[0-9]+\.[0-9]+')
+
+ f = open(file, 'r')
+ for line in f:
+ if any(marker in line for marker in markers):
+ changed_str += version_regex.sub(new_version, line, count=1)
+ else:
+ changed_str += line
+ f.close()
+
+ f = open(file, 'w')
+ f.write(changed_str)
+ f.close()
"""
Change version of every pom.xml, SharedAssemblyInfo.cs,
@@ -347,6 +366,10 @@
change_reef_on_spark_scala(reef_home + "/lang/scala/reef-examples-scala/src/main/scala/org/apache/reef/examples/hellospark/ReefOnSpark.scala", new_version)
print reef_home + "/lang/scala/reef-examples-scala/src/main/scala/org/apache/reef/examples/hellospark/ReefOnSpark.scala"
+ helloreef_readme = "/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md"
+ change_project_number_readme(reef_home + helloreef_readme, new_version)
+ print reef_home + helloreef_readme
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Script for changing REEF version in all files that use it")
parser.add_argument("reef_home", type=str, help="REEF home")
@@ -354,7 +377,7 @@
parser.add_argument("-s", "--isSnapshot", type=str, metavar="<true or false>", help="Change 'IsSnapshot' to true or false", required=True)
parser.add_argument("-p", "--pomonly", help="Change only poms", action="store_true")
args = parser.parse_args()
-
+
reef_home = os.path.abspath(args.reef_home)
reef_version = args.reef_version
is_snapshot = args.isSnapshot
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
index 0ea427e..b1d645f 100644
--- a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
+++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
@@ -6,4 +6,24 @@
* `HelloTask`: This Task prints a greeting to STDOUT of the Evaluator.
## Running it
-Just run the main class, `HelloREEF`, followed by the runtime you want, e.g. `local`.
\ No newline at end of file
+Just run the main class, `HelloREEF`, followed by the runtime you want, e.g. `local`.
+
+## Using as a Standalone Application
+To use HelloREEF as a standalone application, the only changes necessary are installing dependencies and adding a build step to the .csproj file.
+
+Directions
+1. Copy all the \*.cs files to a new directory
+2. In Visual Studio, create a new project from these files
+3. Change the namespaces to `HelloREEF`
+4. Change the .NET framework to `4.5.1`
+5. Change the target platform to `x64`
+6. Use the NuGet to install all dependencies necessary to build the project
+7. Add the following `References` to the .csproj file
+```
+<Reference Include="Org.Apache.REEF.Evaluator, Version=0.16.0.0, Culture=neutral, PublicKeyToken=c27bf5b2e9a7ddb9, processorArchitecture=AMD64\">
+ <HintPath>packages/Org.Apache.REEF.Evaluator.0.16.0/tools/Org.Apache.REEF.Evaluator.exe</HintPath>
+</Reference>
+```
+8. Build the project one last time
+
+Now HelloREEF can be used as the first step of writing a new application with Apache REEF.
\ No newline at end of file