diff --git a/res/dev/make/xowa_compile.xml b/res/dev/make/ant/xowa_compile.xml similarity index 100% rename from res/dev/make/xowa_compile.xml rename to res/dev/make/ant/xowa_compile.xml diff --git a/res/dev/make/xowa_make_jar.xml b/res/dev/make/ant/xowa_make_jar.xml similarity index 100% rename from res/dev/make/xowa_make_jar.xml rename to res/dev/make/ant/xowa_make_jar.xml diff --git a/res/dev/make/maven/build.xml b/res/dev/make/maven/build.xml new file mode 100644 index 000000000..83c88ad0b --- /dev/null +++ b/res/dev/make/maven/build.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/res/dev/make/maven/pom.xml b/res/dev/make/maven/pom.xml new file mode 100644 index 000000000..9d52e6530 --- /dev/null +++ b/res/dev/make/maven/pom.xml @@ -0,0 +1,270 @@ + + 4.0.0 + gplx + xowa_maven + jar + 0.1 + xowa_maven + http://menmachinesmaterials.com + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + org.apache.commons + commons-compress + 1.5 + + + + + com.ibm.icu + icu4j + 63.1 + + + + + org.xerial + sqlite-jdbc + 3.18.0 + + + + xowa + jtidy_xowa + r938 + + + + xowa + luaj_xowa + 2.0 + + + + + com.github.veithen.cosmos.bootstrap + org.tukaani.xz + 0.3 + + + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + 4.3 + + + + + org.apache.lucene + lucene-analyzers-common-mobile + 5.3.0 + + + + + org.apache.lucene + lucene-core-mobile + 5.3.0 + + + + + org.apache.lucene + lucene-highlighter-mobile + 5.3.0 + + + + + org.apache.lucene + lucene-memory-mobile + 5.3.0 + + + + + org.apache.lucene + lucene-queries-mobile + 5.3.0 + + + + + org.apache.lucene + lucene-queryparser-mobile + 5.3.0 + + + + + nu.validator + validator + 18.11.5 + + + + + net.sf.saxon + Saxon-HE + 9.9.1-2 + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + create-jar + package + + + + + + + + + + + + + + + run + + + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + + maven-resources-plugin + 3.0.2 + + + + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + true + lines,vars,source + + + + + maven-surefire-plugin + 2.22.1 + + + + maven-jar-plugin + 3.0.2 + + + + true + + gplx.xowa.Xowa_main + + + + + + + maven-install-plugin + 2.5.2 + + + + maven-deploy-plugin + 2.8.2 + + + + + maven-site-plugin + 3.7.1 + + + + maven-project-info-reports-plugin + 3.0.0 + + + + net.revelc.code.formatter + formatter-maven-plugin + 2.8.1 + + + + + + + + + + format + validate + + + + + + + + + diff --git a/res/dev/make/maven/xowa_maven_boot.sh b/res/dev/make/maven/xowa_maven_boot.sh new file mode 100644 index 000000000..6df314d79 --- /dev/null +++ b/res/dev/make/maven/xowa_maven_boot.sh @@ -0,0 +1,21 @@ +# PLAT_NAME must be one of the following: windows_64,linux_64,macosx_64 +export plat_name=windows_64 + +# ROOT_DIR should be created beforehand, and should be in "/" format +export root=c:/xowa_dev + +# java settings should match your machine +export jdk=1.7 +export JAVA_HOME=C:/000/100_bin/100_os/200_runtime/100_java/100_jdk_1_8_x64 + +# directories should be set to whatever exists on your machine +export ant=C:/000/100_bin/500_dev/110_java/200_apache_ant/bin/ant +export mvn=C:/000/100_bin/500_dev/110_java/210_apache_maven/bin/mvn + +# set "verbose=y" or "verbose=" +export verbose= + +# run other shell scripts +sh xowa_maven_download.sh +sh xowa_maven_files.sh +sh xowa_maven_mvn.sh diff --git a/res/dev/make/maven/xowa_maven_download.sh b/res/dev/make/maven/xowa_maven_download.sh new file mode 100644 index 000000000..673c24307 --- /dev/null +++ b/res/dev/make/maven/xowa_maven_download.sh @@ -0,0 +1,20 @@ +echo * XOWA: downloading latest xowa +cd $root +rm -rf ./src +mkdir src +cd src +git clone https://github.com/gnosygnu/xowa.git +cd .. + +echo * XOWA: regen xowa_maven root +rm -rf ./src/xowa_maven +mkdir -p ./src/xowa_maven + +echo * XOWA: copying maven files to root +cp -rf ./src/xowa/res/dev/make/maven/*.xowa_maven_download.sh ./ +cp -rf ./src/xowa/res/dev/make/maven/*.xowa_maven_files.sh ./ +cp -rf ./src/xowa/res/dev/make/maven/*.xowa_maven_mvn.sh ./ +cp -rf ./src/xowa/res/dev/make/maven/*.txt ./ + +echo * XOWA: copying maven pom.xml and build.xml +cp -rf ./src/xowa/res/dev/make/maven/*.xml ./src/xowa_maven diff --git a/res/dev/make/maven/xowa_maven_files.sh b/res/dev/make/maven/xowa_maven_files.sh new file mode 100644 index 000000000..660915cdb --- /dev/null +++ b/res/dev/make/maven/xowa_maven_files.sh @@ -0,0 +1,58 @@ +echo * XOWA: copy res to xowa_maven +cp -R$verbose ./src/xowa/res ./src/xowa_maven + +echo * XOWA: copy user / bin to runtime locations +cp -R$verbose ./src/xowa_maven/res/user ./src/xowa_maven +cp -R$verbose ./src/xowa_maven/res/bin ./src/xowa_maven + +echo * XOWA: prepare source directories +mkdir -p ./src/xowa_maven/src/main/java/gplx +mkdir -p ./src/xowa_maven/src/test/java/gplx + +echo * XOWA: create mavenize_xowa function +mavenize_xowa () +{ + echo * XOWA: mavenizing $1 + # main <- all non test files + find $1 -depth -type f \ + \( ! -name '*_tst.java' \ + -a ! -name '*_fxt.java' \ + -a ! -name '*_mok.java' \ + -a ! -name '*Test.java' \ + \) \ + -exec cp --parents -pr$verbose '{}' './src/xowa_maven/src/main/java/gplx/' ';' + + # main <- all test files + find $1 -depth -type f \ + \( -name '*_tst.java' \ + -o -name '*_fxt.java' \ + -o -name '*_mok.java' \ + -o -name '*Test.java' \ + \) \ + -exec cp --parents -pr$verbose '{}' './src/xowa_maven/src/test/java/gplx/' ';' +} + +# package: core +mavenize_xowa ./src/xowa/100_core/ + +# package: gfml +mavenize_xowa ./src/xowa/110_gfml/src_100_tkn/gplx/ +mavenize_xowa ./src/xowa/110_gfml/src_200_type/gplx/ +mavenize_xowa ./src/xowa/110_gfml/src_300_gdoc/gplx/ +mavenize_xowa ./src/xowa/110_gfml/src_400_pragma/gplx/ +mavenize_xowa ./src/xowa/110_gfml/src_500_build/gplx/ +mavenize_xowa ./src/xowa/110_gfml/src_600_rdrWtr/gplx/ +mavenize_xowa ./src/xowa/110_gfml/tst/gplx/ + +# package: 140_dbs +mavenize_xowa ./src/xowa/140_dbs/src/gplx/ +# mavenize_xowa ./src/xowa/140_dbs/tst/gplx/ # tests in this folder require mysql and postgres server + +# package: gfui +mavenize_xowa ./src/xowa/150_gfui/src/gplx/ + +# package: xowa +mavenize_xowa ./src/xowa/400_xowa/src/gplx/ + +# package: gflucene +mavenize_xowa ./src/xowa/gplx.gflucene/src/gplx/ diff --git a/res/dev/make/maven/xowa_maven_mvn.sh b/res/dev/make/maven/xowa_maven_mvn.sh new file mode 100644 index 000000000..3ffd0d952 --- /dev/null +++ b/res/dev/make/maven/xowa_maven_mvn.sh @@ -0,0 +1,24 @@ +cd ./src/xowa_maven + +# install files from xowa.git to local repo; note that these files aren't in any maven repository +echo * XOWA: installing non-Maven repo artifacts +$mvn install:install-file -Dfile=bin/any/java/jtidy/jtidy_xowa.jar -DgroupId=xowa -DartifactId=jtidy_xowa -Dversion=r938 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/luaj/luaj_xowa.jar -DgroupId=xowa -DartifactId=luaj_xowa -Dversion=2.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-analyzers-common-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-analyzers-common-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-core-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-core-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-highlighter-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-highlighter-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-memory-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-memory-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-queries-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-queries-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/lucene/5.3.0.drd/lucene-queryparser-5.3.0-mobile-2.jar -DgroupId=org.apache.lucene -DartifactId=lucene-queryparser-mobile -Dversion=5.3.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/jdbc/sqlite/sqlite-jdbc-3.18.0.jar -DgroupId=xowa -DartifactId=sqllite -Dversion=3.18.0 -Dpackaging=jar +$mvn install:install-file -Dfile=bin/any/java/vnu/vnu.jar -DgroupId=xowa -DartifactId=validator -Dversion=18.11.5 -Dpackaging=jar + +echo * XOWA: running +$mvn clean +$mvn formatter:format +$mvn compile +$mvn -Dtest="gplx.**" test +$ant -v -buildfile build.xml -Dplat_name=$plat_name + +echo * XOWA: launching xowa +java -jar xowa_maven.jar diff --git a/res/dev/make/maven/xowa_maven_readme.txt b/res/dev/make/maven/xowa_maven_readme.txt new file mode 100644 index 000000000..3f0633d93 --- /dev/null +++ b/res/dev/make/maven/xowa_maven_readme.txt @@ -0,0 +1,73 @@ +== Reading this file == +To view this file with formatting, do the following: +* Go to https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit +* Paste this entire file into the box +* Press "Show Preview" + +== Purpose == +The xowa_maven.sh script will do the following: +* Download the latest source code of XOWA +* Compile the code +* Run the unit tests +* Build a runnable jar + +== Requirements == +The shell script requires 4 applications: +* Git 2.21+ +* Java 1.7+ JDK +* Maven 3.6+ +* Apache Ant 1.9+ + +The shell script also requires an internet connection for the following: +* Download necessary binaries +* Download XOWA git repository +* Download Maven repositories + +== Setup == +Windows instructions are listed below. +* Java will come installed on most Linux / Mac OS X system +* Git / Maven / Ant can downloaded / set-up + +In addition, file paths in this README follow the Windows convention (C:\xowa\ instead of C:/xowa/) + +However, the shell script uses the Unix convention (C:/xowa/) + +Finally, note that directories are given for example purposes only. Feel free to change C:\xowa_dev to D:\whatever_you_want + +=== Binaries === +==== Git ==== +===== Windows ===== +* Download "Git for Windows Portable" from https://git-scm.com/download/win +* Unzip it to C:\xowa_dev\bin\git + +==== Java 1.8 JDK ==== +* Download "Java SE Development Kit 8u###" from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html +* Install it +* Confirm the JAVA_HOME variable exists + * echo %JAVA_HOME% + * EX: C:\xowa_dev\bin\java_jdk_1_8 + +==== Maven ==== +* Download "apache-maven-#.#.#-bin.zip" https://maven.apache.org/download.cgi +* Unzip it to C:\xowa_dev\bin\maven + +==== Apache Ant ==== +* Download "#.#.##.zip" https://ant.apache.org/bindownload.cgi +* Unzip it to C:\xowa_dev\bin\ant + +==== Minttyrc (Optional: for Ctrl+V) ==== +* Open $HOME/.minttyrc +* Add $CtrlExchangeShift=yes +https://github.com/mintty/mintty/issues/602 + +=== Boot === +* Copy xowa_maven_boot.sh to C:\xowa_dev\xowa_maven_boot.sh +* Review all the exports and make sure they match +** The platform type (windows vs linux vs macosx) +** The directories on your machine + +== Launch Git == +* Run C:\xowa_dev\bin\git\git-bash.exe +* Run git config --global core.autocrlf false + * autocrlf needs to be disabled on Windows boxes, or else, Git will change all .txt to \r\n . This will break xowa.gfs +* Run xowa_maven_boot.sh diff --git a/xowa_get_and_make.sh b/xowa_get_and_make.sh index b51bc041a..a5323d309 100644 --- a/xowa_get_and_make.sh +++ b/xowa_get_and_make.sh @@ -54,5 +54,5 @@ find ./src -type f -name '*_fxt.java' -delete find ./src -type f -name '*_mok.java' -delete # == BUILD XOWA == -$ANT_BINARY -v -buildfile ./dev/make/xowa_compile.xml -Droot_dir=$ROOT_DIR -Djdk=$JAVA_JDK_VERSION -$ANT_BINARY -v -buildfile ./dev/make/xowa_make_jar.xml -Droot_dir=$ROOT_DIR -Dplat_name=$PLAT_NAME -Dxowa_jar_path=$ROOT_DIR/xowa_dev.jar +$ANT_BINARY -v -buildfile ./dev/make/ant/xowa_compile.xml -Droot_dir=$ROOT_DIR -Djdk=$JAVA_JDK_VERSION +$ANT_BINARY -v -buildfile ./dev/make/ant/xowa_make_jar.xml -Droot_dir=$ROOT_DIR -Dplat_name=$PLAT_NAME -Dxowa_jar_path=$ROOT_DIR/xowa_dev.jar