فهرست منبع

Merge pull request #309 from Psiphon-Labs/master

Merge master
Adam Pritchard 9 سال پیش
والد
کامیت
fa78bee2a4
2فایلهای تغییر یافته به همراه44 افزوده شده و 62 حذف شده
  1. 4 0
      .gitignore
  2. 40 62
      MobileLibrary/iOS/build-psiphon-framework.sh

+ 4 - 0
.gitignore

@@ -4,6 +4,7 @@ psiphon.config
 controller_test.config
 psiphon.db*
 psiphon.boltdb
+remote_server_list
 
 # Exclude compiled tunnel core binaries
 ConsoleClient/ConsoleClient
@@ -49,3 +50,6 @@ Thumbs.db
 # Ignore gradle files
 .gradle/
 build/
+
+# Visual Studio Code
+.vscode/

+ 40 - 62
MobileLibrary/iOS/build-psiphon-framework.sh

@@ -134,70 +134,48 @@ if [[ $? != 0 ]]; then
   exit 1
 fi
 
-function check_pinned_version() {
-  echo "Checking for gomobile revision: '${GOMOBILE_PINNED_REV}'"
-  if [ -e ${GOMOBILE_PATH} ]; then
-    echo "..Gomobile path found"
-    cd ${GOMOBILE_PATH}
-    CURRENT_REVISION=$(git rev-parse HEAD)
-    if [ ${CURRENT_REVISION} != ${GOMOBILE_PINNED_REV} ]; then
-      echo "..Current revision '${CURRENT_REVISION}' does not match"
-      return 1
-    else
-      echo "..Current revision matches"
-      return 0
-    fi
-  else
-    echo "Could not find GOMOBILE_PATH (${GOMOBILE_PATH})"
-    return 1
-  fi
-}
+#
+# Get and install gomobile, using our pinned revision
+#
 
-set +e
-check_pinned_version
-rc=$?
-set -e
-if [[ $rc != 0 ]]; then
-    go get -u golang.org/x/mobile/cmd/gomobile
-    cd ${GOPATH}/src/golang.org/x/mobile/cmd/gomobile
-    git checkout master
-    git checkout -b pinned ${GOMOBILE_PINNED_REV}
-
-    # Gomobile messes up the build tags by quoting them incorrectly. We'll hack a fix for it.
-    # First do a grep to see if this code is still there (or has been fixed upstream).
-    grep -q 'strconv.Quote' ./build.go 
-    if [[ $? != 0 ]]; then
-      echo "Upstream gomobile code has changed, breaking hacks."
-      exit 1
-    fi
-    # Then do the hack-fix-replacement.
-    perl -i -pe 's/"-tags="\+strconv\.Quote\(strings.Join\(ctx\.BuildTags, ","\)\),/"-tags",strings.Join(ctx.BuildTags, " "),/g' ./build.go
-    # We also need to remove the now-unused strconv import.
-    perl -i -pe 's/"strconv"//g' ./build.go
-    
-    # Gomobile's iOS code puts an *additional* build tags flag at the end of the command line. This
-    # overrides any existing build tags and messes up our builds. So we'll hack a fix for that, too.
-    # First do a grep to see if this code is still there (or has been fixed upstream).
-    grep -q '"-tags=ios",' ./bind_iosapp.go 
-    if [[ $? != 0 ]]; then
-      echo "Upstream gomobile code has changed, breaking hacks."
-      exit 1
-    fi
-    # Then do the hack-fix-replacement.
-    perl -i -pe 's/(.+)"-tags=ios",(.+)/\tctx.BuildTags = append(ctx.BuildTags, "ios")\n\1\2/g' ./bind_iosapp.go
-    
-    go install
-    ${GOPATH}/bin/gomobile init -v
-    if [[ $? != 0 ]]; then
-      echo "FAILURE: ${GOPATH}/bin/gomobile init -v"
-      exit 1
-    fi
-    check_pinned_version
-    if [[ $? != 0 ]]; then
-      echo "gomobile not found, aborting"
-      exit 1
-    fi
+go get -u golang.org/x/mobile/cmd/gomobile
+cd ${GOPATH}/src/golang.org/x/mobile/cmd/gomobile
+git checkout master
+git checkout -b pinned ${GOMOBILE_PINNED_REV}
+
+# Gomobile messes up the build tags by quoting them incorrectly. We'll hack a fix for it.
+# First do a grep to see if this code is still there (or has been fixed upstream).
+grep -q 'strconv.Quote' ./build.go 
+if [[ $? != 0 ]]; then
+  echo "Upstream gomobile code has changed, breaking hacks."
+  exit 1
+fi
+# Then do the hack-fix-replacement.
+perl -i -pe 's/"-tags="\+strconv\.Quote\(strings.Join\(ctx\.BuildTags, ","\)\),/"-tags",strings.Join(ctx.BuildTags, " "),/g' ./build.go
+# We also need to remove the now-unused strconv import.
+perl -i -pe 's/"strconv"//g' ./build.go
+
+# Gomobile's iOS code puts an *additional* build tags flag at the end of the command line. This
+# overrides any existing build tags and messes up our builds. So we'll hack a fix for that, too.
+# First do a grep to see if this code is still there (or has been fixed upstream).
+grep -q '"-tags=ios",' ./bind_iosapp.go 
+if [[ $? != 0 ]]; then
+  echo "Upstream gomobile code has changed, breaking hacks."
+  exit 1
 fi
+# Then do the hack-fix-replacement.
+perl -i -pe 's/(.+)"-tags=ios",(.+)/\tctx.BuildTags = append(ctx.BuildTags, "ios")\n\1\2/g' ./bind_iosapp.go
+
+go install
+${GOPATH}/bin/gomobile init -v
+if [[ $? != 0 ]]; then
+  echo "FAILURE: ${GOPATH}/bin/gomobile init -v"
+  exit 1
+fi
+
+#
+# gomobile bind
+#
 
 BUILDDATE=$(date +%Y-%m-%dT%H:%M:%S%z)
 BUILDREPO=$(git config --get remote.origin.url)