Skip to content

Commit d71f3b0

Browse files
committed
Merge pull request #56 from brunobowden/update
script refactoring
2 parents 02f5234 + 7c174cd commit d71f3b0

File tree

6 files changed

+90
-33
lines changed

6 files changed

+90
-33
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
# Temp files
2+
*~
13
.gradle
4+
5+
# Build
26
build/
37

48
# Ignore Gradle GUI config
59
gradle-app.setting
610

711
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
812
!gradle-wrapper.jar
13+
14+
# Don't save away IntelliJ config, except code-style which all commits must follow.
15+
**/.idea/
16+
!.idea/codeStyleSettings.xml

.travis.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
# matrix:
1919
# allow_failures:
2020
# # Blocked on (github issue url)
21-
# - env: TEST_DIR=com.example-library
21+
# - env: TEST_DIR=libraryBuilds/com.example-library
2222

2323
branches:
2424
only:
@@ -35,21 +35,7 @@ before_install:
3535
- ./j2objc-gradle/install-osx-jdk7.sh
3636

3737
install:
38-
- export TERM=dumb
39-
- env
40-
- xcrun clang -v
41-
- /usr/libexec/java_home -v 1.7 -F -V
42-
- java -Xmx32m -version && javac -J-Xmx32m -version
43-
- pushd j2objc-gradle
44-
- ./gradlew wrapper
45-
- ./gradlew dependencies
46-
# In this repo, building of the j2objc-gradle plugin is just preperation.
47-
- ./gradlew build
48-
- popd
49-
- pushd libraryBuilds
50-
# Downloads and configures j2objc distribution.
51-
- ./prep.sh
52-
53-
# Note the install prep leaves us in the libraryBuilds directory.
38+
- ./install.sh
39+
5440
script:
55-
- ./run-test.sh $TEST_DIR
41+
- ./run-test.sh libraryBuilds/$TEST_DIR

libraryBuilds/prep.sh renamed to install-j2objc.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
J2OBJC_VERSION=0.9.8.2.1
18-
mkdir localJ2objcDist
19-
mkdir common
17+
# Must be run from the root directory
2018

21-
# Fail if any command fails
22-
set -ev
19+
# Fail if anything fails
20+
set -euv
21+
22+
pushd libraryBuilds
23+
24+
# Specific version can be configured from command line:
25+
# export J2OBJC_VERSION=X.Y.Z
26+
# Default is version number listed on following line:
27+
J2OBJC_VERSION=${J2OBJC_VERSION:=0.9.8.2.1}
28+
29+
# -p flag avoid failure when directory already exists
30+
mkdir -p localJ2objcDist
31+
mkdir -p common
2332

2433
pushd localJ2objcDist
2534

@@ -31,6 +40,12 @@ if [ ! -e $DIST_FILE ]; then
3140
curl -L https://github.com/google/j2objc/releases/download/$J2OBJC_VERSION/j2objc-$J2OBJC_VERSION.zip > $DIST_FILE
3241
unzip $DIST_FILE
3342
echo j2objc.home=$PWD/$DIST_DIR > ../common/local.properties
43+
echo "libraryBuild/common/local.properties configured:"
44+
cat ../common/local.properties
3445
fi
3546

47+
# pop localJ2objcDist
48+
popd
49+
50+
# pop libraryBuilds
3651
popd

install.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Must be run from the root directory
18+
19+
# Fail if anything fails
20+
set -euv
21+
22+
export TERM=dumb
23+
env
24+
xcrun clang -v
25+
26+
/usr/libexec/java_home -v 1.7 -F -V
27+
java -Xmx32m -version && javac -J-Xmx32m -version
28+
29+
# In this repo, building of the j2objc-gradle plugin is just preperation.
30+
pushd j2objc-gradle
31+
./gradlew wrapper
32+
./gradlew dependencies
33+
./gradlew build
34+
popd
35+
36+
# Download and configures j2objc distribution.
37+
./install-j2objc.sh

libraryBuilds/run-all.sh renamed to run-all.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
# Must be run from the root directory
18+
1719
# Fail if anything fails.
18-
set -ev
20+
set -euv
1921

20-
./run-test.sh com.google.code.gson-gson
21-
./run-test.sh org.joda-joda-convert
22-
./run-test.sh joda-time-joda-time
23-
./run-test.sh org.joda-joda-primitives
24-
./run-test.sh org.apache.commons-commons-lang3
22+
./run-test.sh libraryBuilds/com.google.code.gson-gson
23+
./run-test.sh libraryBuilds/org.joda-joda-convert
24+
./run-test.sh libraryBuilds/joda-time-joda-time
25+
./run-test.sh libraryBuilds/org.joda-joda-primitives
26+
./run-test.sh libraryBuilds/org.apache.commons-commons-lang3

libraryBuilds/run-test.sh renamed to run-test.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
# Must be run from the root directory
18+
1719
# Fail if anything fails.
18-
set -ev
20+
set -euv
21+
22+
if [[ "$PWD" =~ libraryBuilds ]]; then
23+
echo "Should be run from project root and not libraryBuilds directory"
24+
exit 1
25+
fi
1926

2027
TEST_DIR=$1
2128
pushd $TEST_DIR
@@ -27,13 +34,15 @@ echo Preparing test $TEST_DIR
2734
# -L follows symbolic links correctly.
2835
find -L . -name prep.sh | while read PREP_SCRIPT_FILE
2936
do
30-
pushd `dirname $PREP_SCRIPT_FILE`
31-
sh prep.sh
32-
popd
37+
pushd `dirname $PREP_SCRIPT_FILE`
38+
sh prep.sh
39+
popd
3340
done
3441

3542
echo Running test $TEST_DIR
3643
./gradlew wrapper
3744
./gradlew clean
3845
./gradlew build --stacktrace
46+
47+
# $TEST_DIR
3948
popd

0 commit comments

Comments
 (0)