Skip to content

Commit fd53377

Browse files
authored
Merge pull request #21 from VirgilSecurity/dev
Added github pages
2 parents c37b7e0 + 06e6dc5 commit fd53377

File tree

3 files changed

+169
-1
lines changed

3 files changed

+169
-1
lines changed

.ci/push-javadoc-to-gh-pages.sh

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (C) 2015-2019 Virgil Security Inc.
4+
#
5+
# All rights reserved.
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions are
9+
# met:
10+
#
11+
# (1) Redistributions of source code must retain the above copyright
12+
# notice, this list of conditions and the following disclaimer.
13+
#
14+
# (2) Redistributions in binary form must reproduce the above copyright
15+
# notice, this list of conditions and the following disclaimer in
16+
# the documentation and/or other materials provided with the
17+
# distribution.
18+
#
19+
# (3) Neither the name of the copyright holder nor the names of its
20+
# contributors may be used to endorse or promote products derived from
21+
# this software without specific prior written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
24+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26+
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
# POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
36+
#
37+
38+
get_version () {
39+
filename=$1 # Get first parameter as filename
40+
local __resultvar=$2 # Get second parameter to return result
41+
42+
version="-1"
43+
44+
while read line; do
45+
46+
firstWord="$(cut -d' ' -f1 <<< "$line")"
47+
48+
if [[ "$firstWord" = "version" ]];
49+
then
50+
version="$(cut -d"'" -f2 <<< "$line")"
51+
fi
52+
53+
done < ${filename}
54+
55+
if [[ "$__resultvar" ]]; then
56+
eval ${__resultvar}="${version}"
57+
else
58+
echo "${version}"
59+
fi
60+
}
61+
62+
generate_index_page() {
63+
cat >"index.html" << EOL
64+
<html>
65+
<head>
66+
<meta charset="utf-8">
67+
<title>Virgil Security E3Kit Java/Kotlin</title>
68+
</head>
69+
<body style="display: flex; align-items: center; flex-direction: column;">
70+
71+
<img style="display: block; margin-left: auto; margin-right: auto;" src="https://cdn.virgilsecurity.com/assets/images/github/logos/virgil-logo-red.png" width="230px" hspace="10" vspace="6" />
72+
73+
<div style="width: r00px">
74+
<h1>Virgil Security E3Kit JavaDoc</h1>
75+
<p>&nbsp;</p>
76+
77+
<h2 style="color:#110B91B0;">User modules</h2>
78+
<hr/>
79+
<h3>E3Kit</h3>
80+
<ul><li><a href="content/ethree-kotlin/${2}/ethree-kotlin/index.html">${2}</a></li></ul>
81+
82+
<h3>E3Kit Coroutines</h3>
83+
<ul><li><a href="content/ethree-kotlin-coroutines/${3}/ethree-kotlin-coroutines/index.html">${3}</a></li></ul>
84+
85+
<p>&nbsp;</p>
86+
<h2 style="color:#110B91B1;">Internal modules</h2>
87+
<hr/>
88+
89+
<h3>E3Kit Common</h3>
90+
<ul><li><a href="content/ethree-common/${1}/ethree-common/index.html">${1}</a></li></ul>
91+
</div>
92+
93+
<p>&nbsp;</p>
94+
<p style="text-align: center">
95+
<a href="https://virgilsecurity.com">Virgil Security, Inc.</a> | <a href="https://github.com/VirgilSecurity/virgil-e3kit-kotlin">E3Kit Github</a>
96+
</p>
97+
</body>
98+
</html>
99+
EOL
100+
}
101+
102+
if [[ "$TRAVIS_REPO_SLUG" == "VirgilSecurity/virgil-e3kit-kotlin" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
103+
104+
echo -e "Publishing javadoc...\n"
105+
106+
# Generate docs
107+
./gradlew :ethree-common:javadocJar
108+
./gradlew :ethree-kotlin:javadocJar
109+
./gradlew :ethree-kotlin-coroutines:javadocJar
110+
111+
versionCommon="-1"
112+
versionEthree="-1"
113+
versionEthreeCoroutines="-1"
114+
115+
# Get each module version
116+
get_version "ethree-common/build.gradle" versionCommon
117+
get_version "ethree-kotlin/build.gradle" versionEthree
118+
get_version "ethree-kotlin-coroutines/build.gradle" versionEthreeCoroutines
119+
120+
# Create each module docs temporary folder
121+
mkdir $HOME/javadoc-latest/
122+
mkdir $HOME/javadoc-latest/${versionCommon}/
123+
mkdir $HOME/javadoc-latest/${versionEthree}/
124+
mkdir $HOME/javadoc-latest/${versionEthreeCoroutines}/
125+
cp -R ethree-common/build/javadoc/. $HOME/javadoc-latest/${versionCommon}/
126+
cp -R ethree-kotlin/build/javadoc/. $HOME/javadoc-latest/${versionEthree}/
127+
cp -R ethree-kotlin-coroutines/build/javadoc/. $HOME/javadoc-latest/${versionEthreeCoroutines}/
128+
129+
# Get last gh-pages docs
130+
cd $HOME
131+
git config --global user.email "travis@travis-ci.org"
132+
git config --global user.name "travis-ci"
133+
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/VirgilSecurity/virgil-e3kit-kotlin gh-pages > /dev/null
134+
135+
# Remove old docs
136+
cd gh-pages
137+
git rm index.html
138+
git rm -rf content
139+
140+
# Create main index page for all modules
141+
versions=(${versionCommon} ${versionEthree} ${versionEthreeCoroutines})
142+
generate_index_page ${versions[*]}
143+
144+
# Move each module docs to actual folder
145+
mkdir content
146+
mkdir content/ethree-common/
147+
mkdir content/ethree-kotlin/
148+
mkdir content/ethree-kotlin-coroutines/
149+
mv $HOME/javadoc-latest/${versionCommon} content/ethree-common/
150+
mv $HOME/javadoc-latest/${versionEthree} content/ethree-kotlin/
151+
mv $HOME/javadoc-latest/${versionEthreeCoroutines} content/ethree-kotlin-coroutines/
152+
153+
# Add new docs to index and commit
154+
git add -f .
155+
git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
156+
git push -fq origin gh-pages > /dev/null
157+
158+
echo -e "Published Javadoc to gh-pages.\n"
159+
fi

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ __dummy.html
158158
# IntelliJ
159159
/out/
160160
/gen
161+
ethree-kotlin/ethree-kotlin.iml
162+
ethree-kotlin-coroutines/ethree-kotlin-coroutines.iml
163+
tests/tests.iml
164+
testscoroutines/testscoroutines.iml
161165

162166
# mpeltonen/sbt-idea plugin
163167
.idea_modules/

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ env:
2525
- ANDROID_EMULATOR_API=24
2626
- ADB_INSTALL_TIMEOUT=5 # minutes
2727
- ANDROID_ABI=default/armeabi-v7a
28+
- secure: Nz/+LNm9NO3PgvrwLIKDVjlJTskzZPKYXWnNe1T8kUflcQp6dygc9M3tqOgXVRTb33DPhZFZoM04fHJ7iAAyOydH0uNt3nI8zujFiQg7wGOm4vUczk6PYQrWNe/uAyrov+KjLbjNElBxZPDgMDTRD2e3j+UG0X+Xzjm3LqrWChpDjS037EuCpEILNdNETkHeAMVwAvcHrWkXiFMO6aYCHV+teo0zivrELbo6MCaxfMOKY0eMckgxJFtQbAF3hshr98325cczvIzQt5J/bFBkMaBx0IkSDAktDk++jVnoqIfpQVkM6x4mSjz64Q22BW5wIHsgfkT/Cjm7vn1LNpQsPO28p1Ja/W3TqVCeU1XR6sm7Zn+3b7ecSfGjh7p8L6gu9rzpsGIHOG88aWZuqpnF5Vgxjs4l2AXd/luAjv0ATLY45A9SMllLgzixrV4R0xn/DWUlKHsZ4KjiZZipFRXHYvxI/iB8BJR+fRSPKqWWtVxB44mHN7zBS5PvRfu/L7AugF3C2+5OgU+r15u+hQYdHxOrQhWEUKObSJ42MKjEzwaH6oioYKee0ImdB1iPu0IP1jvcImtWanPGU/wxP4ssjTdEOAZepJg90gNes/Hx2gdal6iRtvN2G1xpCJXty4EBLbK2lIfXP6//IiQG0EDLAJfw5npRBluiDvG/tcDxW1E=
29+
- secure: C7b6XlTt+gqr3O4avm7CwgheSi0o0Hn0SQPZHa1Fs9+xbcNLI5EAE6BMNIDH/70aOl/DygJptxmr7Fx8NwAiU+dGWKqe6NhIqpZiizGz9o1J3FpoF5+v+r0777b2oHrqnUiBT7MO//3R1kFL4WmEyoEKzkwT5yMz3qnCI1feKCvKXtLdoyDt3E9w9fMz83lWSXIp0YYpaMyUDKBVwdkbPFbfvr9Ew2spWjTrUkb0gVTbz+GHzdX0Y0PrKHusdZiLQSd3MqmXP7y4VcIafzKEWgXaxe94GBc/r5v9RLBwhqORIhtcu0GJMq9KuWH2uROspgJ9jzgAAJcrTWxaNJ02oarRQF7QdJPdfuIq5XLGqOaMCLKAFjAaogyPacfbUmcfeFokbPW9I7LoHIDcCydSdYC3K3Iw725FoPoNhVncOuwxouMnaWECXLQVlxCQmNN8QSlTBC6bFrgQ/2NwkMPSkMKr+/dKxnPvnWmo6uzqGSZwnLoGlnIryNPzIf8CZTsSWcl6dWxw7LYNMuPOVZGz4AMN8NKFqIrbl0sE3cr00z8N1FHwX2hD2D6dYRMpnv5l6N6ZxxKQT4BwmmpnFIIiKJyoNodUlgYtZX3iJICLQcpmHTrTle+h6XT24biUFF/uPO2TUGmhCEVzLgdlPvbiCePlAg1oytJIxmXjrmCJx/A=
2830

2931
android:
3032
components:
@@ -64,4 +66,7 @@ before_script:
6466
- adb shell input keyevent 82 &
6567

6668
script:
67-
- "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"
69+
- "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"
70+
71+
after_success:
72+
.ci/push-javadoc-to-gh-pages.sh

0 commit comments

Comments
 (0)