You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by mo...@apache.org on 2017/09/20 20:07:14 UTC

reef git commit: [REEF-1839] HelloREEF doesn't have instructions to use as a standalone application

Repository: reef
Updated Branches:
  refs/heads/master c0477f512 -> 9fb6cc41a


[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


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/9fb6cc41
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/9fb6cc41
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/9fb6cc41

Branch: refs/heads/master
Commit: 9fb6cc41ad06c660c1be8bbcf38349e01e6c41f5
Parents: c0477f5
Author: roganc <ro...@microsoft.com>
Authored: Wed Jul 26 11:39:48 2017 -0700
Committer: Sergiy Matusevych <mo...@apache.com>
Committed: Wed Sep 20 13:05:32 2017 -0700

----------------------------------------------------------------------
 dev/change_version.py                           | 33 +++++++++++++++++---
 .../Readme.md                                   | 22 ++++++++++++-
 2 files changed, 49 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/9fb6cc41/dev/change_version.py
----------------------------------------------------------------------
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 @@ def change_pom(file, new_version):
 
     while True:
         line = f.readline()
-        if not line: 
+        if not line:
             break
         changed_str += line
     f.close()
@@ -123,7 +124,7 @@ Change version in SharedAssemblyInfo.cs and AssemblyInfo.cpp
 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 @@ def change_assembly_info_cs(file, new_version):
     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 @@ def change_project_number_Doxyfile(file, new_version):
     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 @@ def change_version(reef_home, new_version, pom_only):
         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 @@ if __name__ == "__main__":
     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

http://git-wip-us.apache.org/repos/asf/reef/blob/9fb6cc41/lang/cs/Org.Apache.REEF.Examples.HelloREEF/Readme.md
----------------------------------------------------------------------
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 @@ This project contains a simple example of a REEF Program. It contains the follow
   * `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