Skip to content

Commit dedc04f

Browse files
committed
Add a Makefile to auto-build everything in a headless environment
1 parent babf5de commit dedc04f

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

Makefile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# To use this file, run:
2+
#
3+
# $ make CONFIGURE_FLAGS="-Dplugin.path=/path/to/your/eclipse/plugins"
4+
#
5+
# For example, on Debian GNU/Linux:
6+
#
7+
# $ make CONFIGURE_FLAGS="-Dplugin.path=/usr/lib/eclipse:/usr/share/eclipse/dropins/jdt"
8+
#
9+
# You can also add e.g. "-DforceContextQualifier=none" to make the jars be
10+
# output under a stable filename.
11+
#
12+
CONFIGURE_FLAGS +=
13+
CORE_FLAGS +=
14+
INCUBATOR_FLAGS += -DjavacSource=6 -DjavacTarget=6
15+
16+
CORE_PLUGINS = net.sf.j2s.core net.sf.j2s.ajax net.sf.j2s.lib net.sf.j2s.ui
17+
INCUBATOR_PLUGINS = net.sf.j2s.ui.template.velocity net.sf.j2s.ui.cmdline
18+
19+
BUILD_WORKSPACE := $(PWD)/autobuild
20+
ECLIPSE_ANT = eclipse -clean -data $(BUILD_WORKSPACE) -nosplash \
21+
-application org.eclipse.ant.core.antRunner
22+
23+
ECLIPSE_ANT_BUILD = $(ECLIPSE_ANT) build.update.jar
24+
ECLIPSE_ANT_CLEAN = if [ -f build.xml ]; then \
25+
$(ECLIPSE_ANT) clean; \
26+
rm -rf build.xml javaCompiler...args; \
27+
fi
28+
29+
all: build
30+
31+
configure:
32+
$(ECLIPSE_ANT) -f configure.xml $(CONFIGURE_FLAGS)
33+
34+
build: configure
35+
for i in $(CORE_PLUGINS:%=sources/%); do \
36+
( cd $$i && $(ECLIPSE_ANT_BUILD) $(CORE_FLAGS); ) \
37+
done
38+
for i in $(INCUBATOR_PLUGINS:%=incubator/%); do \
39+
( cd $$i && $(ECLIPSE_ANT_BUILD) $(INCUBATOR_FLAGS); ) \
40+
done
41+
42+
clean:
43+
for i in $(INCUBATOR_PLUGINS:%=incubator/%); do \
44+
( cd $$i && $(ECLIPSE_ANT_CLEAN); ) \
45+
done
46+
for i in $(CORE_PLUGINS:%=sources/%); do \
47+
( cd $$i && $(ECLIPSE_ANT_CLEAN); ) \
48+
done
49+
rm -rf $(BUILD_WORKSPACE)/.metadata
50+
51+
prefix ?= /usr/local
52+
datadir ?= $(prefix)/share/eclipse
53+
pluginsdir ?= $(datadir)/plugins
54+
55+
install:
56+
test -z "$(DESTDIR)$(pluginsdir)" || mkdir -p "$(DESTDIR)$(pluginsdir)"
57+
install -t "$(DESTDIR)$(pluginsdir)" \
58+
$(join $(CORE_PLUGINS:%=sources/%/),$(CORE_PLUGINS:%=%_2.0.0.jar)) \
59+
$(join $(INCUBATOR_PLUGINS:%=incubator/%/),$(INCUBATOR_PLUGINS:%=%_1.0.0.*.jar))
60+
61+
.PHONY: all configure build clean install

configure.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="java2script" default="configure" basedir=".">
3+
<!-- IMPORTANT!
4+
5+
This is not a normal ant build file. You need to run it via the Eclipse
6+
AntRunner, like this Unix shell example:
7+
8+
# The -data $PWD is important; otherwise it will use your default
9+
# workspace and possibly clobber it, or simply fail the build.
10+
$ eclipse -clean -data $PWD -nosplash \
11+
-application org.eclipse.ant.core.antRunner \
12+
-buildfile build.xml \
13+
-Dplugin.path=/usr/lib/eclipse:/usr/share/eclipse/dropins/jdt
14+
15+
For more details see http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_feature_generating_antcommandline.htm
16+
-->
17+
<target name="configure">
18+
<eclipse.buildScript elements="plugin@net.sf.j2s.core"
19+
buildDirectory="sources"
20+
pluginPath="${plugin.path}"
21+
forceContextQualifier="${forceContextQualifier}" />
22+
<eclipse.buildScript elements="plugin@net.sf.j2s.ajax"
23+
buildDirectory="sources"
24+
pluginPath="${plugin.path}"
25+
forceContextQualifier="${forceContextQualifier}" />
26+
<eclipse.buildScript elements="plugin@net.sf.j2s.lib"
27+
buildDirectory="sources"
28+
pluginPath="${plugin.path}"
29+
forceContextQualifier="${forceContextQualifier}" />
30+
<eclipse.buildScript elements="plugin@net.sf.j2s.ui"
31+
buildDirectory="sources"
32+
pluginPath="${plugin.path}"
33+
forceContextQualifier="${forceContextQualifier}" />
34+
<eclipse.buildScript elements="plugin@net.sf.j2s.ui.template.velocity"
35+
buildDirectory="incubator"
36+
pluginPath="${plugin.path}${path.separator}sources"
37+
forceContextQualifier="${forceContextQualifier}" />
38+
<eclipse.buildScript elements="plugin@net.sf.j2s.ui.cmdline"
39+
buildDirectory="incubator"
40+
pluginPath="${plugin.path}${path.separator}sources"
41+
forceContextQualifier="${forceContextQualifier}" />
42+
</target>
43+
</project>

0 commit comments

Comments
 (0)