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

add ant option for building and travis ci #154

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ CoC-AIR.airi
/.idea/codeStyles/Project.xml
/.idea/codeStyles/codeStyleConfig.xml
/.idea/.gitignore
Corruption-of-Champions.iml
/.idea/runConfigurations.xml
/.vscode/
Corruption-of-Champions.iml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "build-dep"]
path = build-dep
url = https://github.com/brrritssocold/CoC-build-dependencies.git
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# travis-ci does not support actionscript.
# However the build uses ant, which is usually used to build java projects.
# The ant task (mxmlc) provided by the flex SDK (ant/lib/flexTasks.jar) is used to build the project.
language: java
os: linux
dist: xenial
addons:
apt:
packages:
- vnc4server
- xfce4
- ant
- ant-optional
- xfonts-base

jdk: openjdk8

before_install:
# So flexunit can find the player and the ant build file does not have to be modified
- sudo cp build-dep/bin/flashplayer /usr/local/bin/gflashplayer

install:
# start a VNC session, this will be the desktop for tests
- Xvnc :1 &

script:
# this is where the build happens. A separate build is started for every entry in the matrix element
- travis_wait ant $BUILD

env:
global:
# tell the build file where to find the flex SDK
- FLEX_HOME="build-dep/bin/flex/"
# this is to trick the flash player into thinking it is running on a desktop
- DISPLAY=":1"
jobs:
# different configurations that should be built
- BUILD="release"
- BUILD="debug"

# Just so Travis.CI won't complain about Vanilla+ failing, since V+ wasn't intended to use Travis.
branches:
except:
VanillaPlus
1 change: 1 addition & 0 deletions build-dep
Submodule build-dep added at 0b9f1f
56 changes: 56 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<project name="Corruption of Champions Build Script" default="testAndRelease">

<!-- Create a environment variable FLEX_HOME that points to the flex SDK -->
<property environment="env" />
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />

<property name="main.src.dir" value="${basedir}/classes"/>
<property name="test.src.dir" value="${basedir}/test"/>
<property name="lib.dir" value="${basedir}/lib/bin"/>
<property name="build.dir" value="${basedir}/target"/>
<property name="report.dir" value="${build.dir}/report"/>
<property name="test.file" value="${build.dir}/CoC-test.swf"/>

<!-- Setup Flex and FlexUnit ant tasks -->
<!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

<!-- delete and create the DEPLOY dir again -->
<target name="init">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${report.dir}" />
</target>

<macrodef name="build-game-binary">
<attribute name="debug-flag"/>
<attribute name="release-flag"/>
<attribute name="binary-name"/>
<sequential>
<!-- build the game binary -->
<mxmlc file="${main.src.dir}/classes/CoC.as" output="${build.dir}/@{binary-name}" static-rsls="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<source-path path-element="${main.src.dir}"/>
<compiler.debug>@{debug-flag}</compiler.debug>
<use-network>false</use-network>
<library-path dir="${lib.dir}" includes="*.swc" append="true"/>
<define name="CONFIG::release" value="@{release-flag}"/>
<define name="CONFIG::debug" value="@{debug-flag}"/>
<define name="CONFIG::AIR" value="false"/>
<define name="CONFIG::STANDALONE" value="true"/>
</mxmlc>
</sequential>
</macrodef>

<target name="release" depends="init" description="Build with release flags">
<build-game-binary debug-flag="false" release-flag="true" binary-name="CoC-release.swf"></build-game-binary>
</target>

<target name="debug" depends="init" description="Build with debug flags">
<build-game-binary debug-flag="true" release-flag="false" binary-name="CoC-debug.swf"></build-game-binary>
</target>

<target name="all" depends="init,release,debug" description="Build all swf versions">
</target>
</project>