Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android fix get_environment.sh #19690

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ temp/

# external libs zip
*.zip
**/simulator/
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~/.bash_profile may not exists on linux

fi

echo $COCOS_CONSOLE_ROOT
11 changes: 9 additions & 2 deletions tests/js-tests/project/proj.android/app/get_environment.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
10 changes: 9 additions & 1 deletion tests/lua-empty-test/project/proj.android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,19 @@ def getCocosCommandPath() {
return 'cocos.bat'
}
else {

def env_console_path = System.getenv("COCOS_CONSOLE_ROOT")

if (env_console_path != null && !env_console_path.trim().isEmpty()) {
return new File(env_console_path.trim() + '/cocos').absolutePath
}

// on unix like system, can not get environments variables easily
// so run a shell script to get environment variable sets by cocos2d-x setup.py
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = project.file('get_environment.sh')
executable = "/bin/bash"
args = [ "-i", project.file('get_environment.sh')]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://linux.die.net/man/1/bash

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option,
it first reads and executes commands from the file /etc/profile, if that file exists. After reading that
file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes
commands from the first one that exists and is readable. The --noprofile option may be used when the shell
is started to inhibit this behavior.

standardOutput = os
}
ext.console_path = os.toString().trim()
Expand Down
11 changes: 9 additions & 2 deletions tests/lua-empty-test/project/proj.android/app/get_environment.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 14 17:47:54 CST 2017
#Fri May 10 15:15:29 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
2 changes: 1 addition & 1 deletion tools/cocos2d-console
Submodule cocos2d-console updated 1 files
+9 −2 plugins/plugin_compile/project_compile.py