Skip to content
Snippets Groups Projects
Commit 1a3de9a5 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

- Documentation : Add gradle installation

- Build: Add a docker file
parent c498c50d
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -8,6 +8,9 @@
/platforms/*
!/platforms/desktop
!/platforms/android
/resources/android/build/local.properties
/resources/android/build/Cesium.keystore
/resources/android/build/release-signing.properties
/plugins/
.idea/
/*.iml
......
FROM ubuntu:16.04
LABEL maintainer="benoit [dot] lavenier [at] e-is [dot] pro"
ENV DEBIAN_FRONTEND=noninteractive \
ANDROID_HOME=/opt/android-sdk-linux \
NODE_VERSION=5.12.0 \
NPM_VERSION=3.8.6 \
IONIC_VERSION=1.7.16 \
BOWER_VERSION=1.8.0 \
CORDOVA_VERSION=6.5.0 \
GRADLE_VERSION=4.1 \
NDK_VERSION=r10e
# Install basics
RUN apt-get update && \
apt-get install -y git wget curl unzip build-essential ruby ruby-dev ruby-ffi gcc make && \
curl --retry 3 -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" && \
tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 && \
rm "node-v$NODE_VERSION-linux-x64.tar.gz" && \
npm install -g npm@"$NPM_VERSION" && \
npm install -g bower@"$BOWER_VERSION" cordova@"$CORDOVA_VERSION" ionic@"$IONIC_VERSION" && \
npm cache clear --force
# install python-software-properties (so you can do add-apt-repository)
RUN apt-get update && apt-get install -y -q python-software-properties software-properties-common && \
add-apt-repository ppa:webupd8team/java -y && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
apt-get update && apt-get -y install oracle-java8-installer
#ANDROID STUFF
RUN echo ANDROID_HOME="${ANDROID_HOME}" >> /etc/environment && \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --force-yes expect ant wget zipalign libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 qemu-kvm kmod && \
apt-get clean && \
apt-get autoclean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Android SDK
RUN cd /opt && \
wget --output-document=android-sdk.tgz --quiet http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \
tar xzf android-sdk.tgz && \
rm -f android-sdk.tgz && \
chown -R root. /opt
RUN cd /opt/ && \
wget --output-document=android-ndk.zip --quiet https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip && \
unzip android-ndk.zip && \
rm android-ndk.zip && \
chown -R root. /opt
# Install Gradle
RUN wget https://services.gradle.org/distributions/gradle-"$GRADLE_VERSION"-bin.zip && \
mkdir /opt/gradle && \
unzip -d /opt/gradle gradle-"$GRADLE_VERSION"-bin.zip && \
rm -rf gradle-"$GRADLE_VERSION"-bin.zip
# Setup environment
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:/opt/tools:/opt/gradle/gradle-"$GRADLE_VERSION"/bin
# Install sdk elements
COPY resources/android/build/tools /opt/tools
RUN chmod u+x /opt/tools/*.sh
RUN ["/opt/tools/android-accept-licenses.sh", "android update sdk --all --no-ui --filter platform-tools,tools,build-tools-26.0.0,android-26,build-tools-25.0.0,android-25,extra-android-support,extra-android-m2repository,extra-google-m2repository"]
RUN unzip ${ANDROID_HOME}/temp/*.zip -d ${ANDROID_HOME}
# Install source code
#RUN git config --global user.email "user.name@domain.com" && \
# git config --global user.name "User Name" && \
RUN git clone git@git.duniter.org:clients/cesium-grp/cesium.git && \
cd cesium && \
npm install
# Restore cordova platforms
RUN cd cesium && \
ionic state restore
# TODO: Test First Build so that it will be faster later
## ionic cordova build android --prod --no-interactive --release
WORKDIR cesium
EXPOSE 8100 35729
CMD ["ionic", "serve"]
......@@ -73,6 +73,12 @@ Install the version that it proposes to you.
- Fill in the installation path of the NDK.
### Install Gradle
- Download [Gradle 4.1](wget https://services.gradle.org/distributions/gradle-4.1-bin.zip)
- Uncompress the archive (e.g in `/opt/gradle`).
## Android configuration
Android need some configuration, to be able to build Cesium.
......@@ -102,6 +108,7 @@ storePassword=YourStorePassword
keyPassword=YourKeyPassword
```
- Open Android Studio, then open the menu `File > Settings...`. Set `Gradle Home` to your fresh Gradle installation directory (e.g. `/opt/gradle`).
## Generate APK file
......@@ -123,11 +130,11 @@ Generated APK files should be in the directory `platforms/android/build/outputs/
If you get this error:
```
Cannot run program "/opt/android-sdk/build-tools/21.1.2/aapt": error=2, No such file or folder
```
```
Cannot run program "/opt/android-sdk/build-tools/21.1.2/aapt": error=2, No such file or folder
```
Install two additional compatibility libraries (workaround found in [this post](http://stackoverflow.com/questions/22701405/aapt-ioexception-error-2-no-such-file-or-directory-why-cant-i-build-my-grad)):
Then install two additional compatibility libraries (workaround found in [this post](http://stackoverflow.com/questions/22701405/aapt-ioexception-error-2-no-such-file-or-directory-why-cant-i-build-my-grad)):
```bash
sudo apt-get install lib32stdc++6 lib32z1
```
# Cesium docker image
## Build
```bash
cd cesium
sudo docker build . -t cesium/release
```
or with interactive bash
```bash
sudo docker build . -ti cesium/release bash
```
## Run
```bash
sudo docker run -ti --net host -p 8100:8100 -p 35729:35729 -v ~/.gradle:/root/.gradle -v \$PWD:/cesium:rw --privileged cesium/release
```
\ No newline at end of file
......@@ -23,10 +23,22 @@ if (rootdir) {
console.log('-----------------------------------------');
if (fs.existsSync(android_dir) && fs.existsSync(build_dir)) {
var mkdirp = function(dir) {
var parent = path.dirname(dir);
if (!fs.existsSync(parent)){
mkdirp(parent);
}
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
};
glob(build_files, null, function(er, files) {
files.forEach(function(file) {
console.log(' Copy ' + file + ' to ' + android_dir);
var dest_file = file.replace(build_dir, android_dir);
mkdirp(path.dirname(dest_file));
fs.createReadStream(file).pipe(fs.createWriteStream(dest_file));
});
});
......
......@@ -19,4 +19,4 @@
"version": "12.41.296.5"
}
]
}
\ No newline at end of file
}
......@@ -9,7 +9,10 @@
"scripts": {
"postinstall": "bower install --allow-root",
"install-platforms": "ionic state restore",
"start": "ionic serve"
"start": "ionic serve",
"docker:build": "sudo docker build . -t cesium/release",
"docker:run": "sudo docker run -ti --rm -p 8100:8100 -p 35729:35729 -v .:/cesium:rw cesium/release",
"build:web": "config --env default && gulp build:web --release"
},
"keywords": [
"duniter",
......
#!/usr/bin/expect -f
set timeout 1800
set cmd [lindex $argv 0]
set licenses [lindex $argv 1]
spawn {*}$cmd
expect {
"Do you accept the license '*'*" {
exp_send "y\r"
exp_continue
}
eof
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment