-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Makefile to auto-build everything in a headless environment
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# To use this file, run: | ||
# | ||
# $ make CONFIGURE_FLAGS="-Dplugin.path=/path/to/your/eclipse/plugins" | ||
# | ||
# For example, on Debian GNU/Linux: | ||
# | ||
# $ make CONFIGURE_FLAGS="-Dplugin.path=/usr/lib/eclipse:/usr/share/eclipse/dropins/jdt" | ||
# | ||
# You can also add e.g. "-DforceContextQualifier=none" to make the jars be | ||
# output under a stable filename. | ||
# | ||
# Due to https://github.com/zhourenjian/java2script/issues/7 you may need to | ||
# run this using xvfb https://packages.debian.org/sid/xvfb | ||
# | ||
CONFIGURE_FLAGS += | ||
CORE_FLAGS += -DjavacFailOnError=true | ||
INCUBATOR_FLAGS += -DjavacFailOnError=true -DjavacSource=1.6 -DjavacTarget=1.6 | ||
|
||
# Order is important; dependencies must go earlier. | ||
CORE_PLUGINS = net.sf.j2s.core net.sf.j2s.ajax net.sf.j2s.ui net.sf.j2s.lib | ||
INCUBATOR_PLUGINS = net.sf.j2s.ui.template.velocity net.sf.j2s.ui.cmdline | ||
CORE_J2SLIB = net.sf.j2s.ajax net.sf.j2s.java.core net.sf.j2s.java.org.eclipse.swt | ||
|
||
BUILD_WORKSPACE := $(PWD)/autobuild | ||
ECLIPSE_AUTO = eclipse \ | ||
-configuration $(BUILD_WORKSPACE)/configuration \ | ||
-user $(BUILD_WORKSPACE) \ | ||
-data $(BUILD_WORKSPACE) \ | ||
-nosplash -clean | ||
|
||
ECLIPSE_ANT = $(ECLIPSE_AUTO) \ | ||
-application org.eclipse.ant.core.antRunner | ||
ECLIPSE_ANT_BUILD = $(ECLIPSE_ANT) build.update.jar | ||
ECLIPSE_ANT_CLEAN = if [ -f build.xml ]; then \ | ||
$(ECLIPSE_ANT) clean; \ | ||
rm -rf build.xml javaCompiler...args; \ | ||
fi | ||
ECLIPSE_J2S = $(ECLIPSE_AUTO) \ | ||
-application net.sf.j2s.ui.cmdlineApi | ||
|
||
all: build-libs | ||
|
||
configure: | ||
$(ECLIPSE_ANT) -f configure.xml $(CONFIGURE_FLAGS) | ||
|
||
build-plugins: configure | ||
set -e; for i in $(CORE_PLUGINS:%=sources/%); do \ | ||
( cd $$i && $(ECLIPSE_ANT_BUILD) $(CORE_FLAGS); ) \ | ||
done | ||
set -e; for i in $(INCUBATOR_PLUGINS:%=incubator/%); do \ | ||
( cd $$i && $(ECLIPSE_ANT_BUILD) $(INCUBATOR_FLAGS); ) \ | ||
done | ||
|
||
local-install-plugins: build-plugins | ||
$(MAKE) DESTDIR=$(BUILD_WORKSPACE) datadir= install | ||
mkdir -p $(BUILD_WORKSPACE)/features | ||
touch $(BUILD_WORKSPACE)/artifacts.xml | ||
$(ECLIPSE_AUTO) -initialize | ||
|
||
build-libs: local-install-plugins | ||
# TODO: The java.core build segfaults quite often, but sometimes works :( | ||
set -e; for i in $(CORE_J2SLIB); do \ | ||
$(ECLIPSE_J2S) -cmd build -path $$PWD/sources/$$i; \ | ||
done | ||
mkdir -p sources/net.sf.j2s.lib/bin | ||
cd sources/net.sf.j2s.lib/bin && jar xf ../library.jar | ||
cd sources/net.sf.j2s.lib && ant -f build/build.xml | ||
cd sources/net.sf.j2s.lib && zip -r j2slib.zip j2slib | ||
|
||
clean: | ||
for i in $(INCUBATOR_PLUGINS:%=incubator/%); do \ | ||
( cd $$i && $(ECLIPSE_ANT_CLEAN); ) \ | ||
done | ||
for i in $(CORE_PLUGINS:%=sources/%); do \ | ||
( cd $$i && $(ECLIPSE_ANT_CLEAN); ) \ | ||
done | ||
rm -rf $(BUILD_WORKSPACE)/.metadata | ||
|
||
prefix ?= /usr/local | ||
datadir ?= $(prefix)/share/eclipse | ||
pluginsdir ?= $(datadir)/plugins | ||
|
||
install: | ||
test -z "$(DESTDIR)$(pluginsdir)" || mkdir -p "$(DESTDIR)$(pluginsdir)" | ||
install -t "$(DESTDIR)$(pluginsdir)" \ | ||
$(join $(CORE_PLUGINS:%=sources/%/),$(CORE_PLUGINS:%=%_2.0.0.jar)) \ | ||
$(join $(INCUBATOR_PLUGINS:%=incubator/%/),$(INCUBATOR_PLUGINS:%=%_1.0.0.*.jar)) | ||
|
||
.PHONY: all configure build-plugins local-install-plugins build-libs clean install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="java2script" default="configure" basedir="."> | ||
<!-- IMPORTANT! | ||
This is not a normal ant build file. You need to run it via the Eclipse | ||
AntRunner, like this Unix shell example: | ||
$ eclipse -nosplash -clean \ | ||
-configuration $PWD/autobuild/configuration \ | ||
-user $PWD/autobuild \ | ||
-data $PWD/autobuild \ | ||
-application org.eclipse.ant.core.antRunner \ | ||
-buildfile build.xml \ | ||
-Dplugin.path=/usr/lib/eclipse:/usr/share/eclipse/dropins/jdt | ||
Setting the -configuration, -user, and -data options are important in an | ||
automated build process where you don't want to clobber the default locations. | ||
For more details see http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_feature_generating_antcommandline.htm | ||
--> | ||
<target name="configure"> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.core" | ||
buildDirectory="sources" | ||
pluginPath="${plugin.path}" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.ajax" | ||
buildDirectory="sources" | ||
pluginPath="${plugin.path}" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.lib" | ||
buildDirectory="sources" | ||
pluginPath="${plugin.path}" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.ui" | ||
buildDirectory="sources" | ||
pluginPath="${plugin.path}" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.ui.template.velocity" | ||
buildDirectory="incubator" | ||
pluginPath="${plugin.path}${path.separator}sources" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
<eclipse.buildScript elements="plugin@net.sf.j2s.ui.cmdline" | ||
buildDirectory="incubator" | ||
pluginPath="${plugin.path}${path.separator}sources" | ||
forceContextQualifier="${forceContextQualifier}" /> | ||
</target> | ||
</project> |