Skip to content
Merged
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
47 changes: 30 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
.idea
.idea/
.gradle/
.projectKnowledge/
build/
dist/
bin/
lib/
nbproject/
doc/API/
.classpath
nbbuild.xml
manifest.mf
*.iml
/dist
/bin
/nbproject
/doc/API
/.classpath
/server/META-INF/java/JavaProxy.php
/server/META-INF/java/Java.inc
/server/php/java/bridge/JavaProxy.java
/server/php/java/bridge/LauncherWindows.java
/server/php/java/bridge/LauncherWindows2.java
/server/php/java/bridge/LauncherWindows3.java
/server/php/java/bridge/LauncherUnix.java
/server/php/java/bridge/JavaInc.java
/server/php/java/bridge/LauncherWindows4.java
/server/php/java/bridge/PhpDebuggerPHP.java

*.lock
*.log
devNull
server/META-INF/java/Java.inc
server/META-INF/java/JavaProxy.php
src/main/java/io/soluble/pjb/bridge/JavaInc.java
src/main/java/io/soluble/pjb/bridge/JavaProxy.java
src/main/java/io/soluble/pjb/bridge/LauncherUnix.java
src/main/java/io/soluble/pjb/bridge/LauncherWindows.java
src/main/java/io/soluble/pjb/bridge/LauncherWindows2.java
src/main/java/io/soluble/pjb/bridge/LauncherWindows3.java
src/main/java/io/soluble/pjb/bridge/LauncherWindows4.java
src/main/resources/META-INF/java/Java.inc
src/main/resources/META-INF/java/JavaProxy.php
/.nb-gradle/
.nb-gradle-properties
src/main/webapp/java/Java.inc
src/main/webapp/java/JavaProxy.php
63 changes: 59 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,77 @@
group 'io.soluble.php-java-bridge'
version '6.1.11-SNAPSHOT'
group 'io.soluble.pjb'
version '6.2.11'

ant.importBuild 'build.xml'

apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'war'
apply plugin: 'com.bmuschko.tomcat' // provides embedded tomcat 7

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

sourceCompatibility = 1.7
targetCompatibility = 1.7

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
providedCompile('javax.servlet:servlet-api:2.5')
testCompile('junit:junit:3.8.2') // the project still uses this junit API

def tomcatVersion = '7.0.59'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
}

jar {
baseName "JavaBridge"
manifest {
attributes("Main-Class": "io.soluble.pjb.Standalone",
"Implementation-Title": "php-java-bridge.jar",
"Implementation-Version": version)
}
}

war {
baseName "JavaBridge"
//from 'src/rootContent' // adds a file-set to the root of the archive
}

clean {
dependsOn cleanBuild
dependsOn genClean
}

compileJava {
dependsOn genAll
}

jacocoTestReport {
group = "Reporting"
reports {
xml.enabled true
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
}

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.0'
}
}

[tomcatRun, tomcatRunWar]*.contextPath = '/JavaBridge'
[tomcatRun, tomcatRunWar]*.daemon = true

102 changes: 96 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,99 @@
<?xml version="1.0"?>
<project name="JavaBridge" basedir="." default="all">

<target name="genInit">
<property name="srcDir" value="${basedir}/src"/>
<property name="distDir" value="${basedir}/build"/>
<property name="serverDir" value="${basedir}/server"/>
<property name="javaDir" value="${srcDir}/main/java"/>
<property name="pkgDir" value="${javaDir}/io/soluble/pjb"/>
<property name="resDir" value="${srcDir}/main/resources"/>
<property name="webappDir" value="${srcDir}/main/webapp"/>
<property name="php_exec" value="php"/>
</target>
<target name="genClean" depends="genInit">
<delete file="${resDir}/META-INF/java/Java.inc"/>
<delete file="${resDir}/META-INF/java/JavaProxy.php"/>
<delete file="${pkgDir}/bridge/JavaInc.java"/>
<delete file="${pkgDir}/bridge/JavaProxy.java"/>
<delete file="${pkgDir}/bridge/LauncherUnix.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows2.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows3.java"/>
<delete file="${pkgDir}/bridge/LauncherWindows4.java"/>
</target>
<target name="genJavaInc" depends="genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="${serverDir}/buildJavaInc.php"/>
<arg value="${resDir}/META-INF/java/Java.inc"/>
<arg value="META-INF/java/JavaBridge.inc"/>
<arg value="META-INF/java/Options.inc"/>
<arg value="META-INF/java/Client.inc"/>
<arg value="META-INF/java/GlobalRef.inc"/>
<arg value="META-INF/java/NativeParser.inc"/>
<arg value="META-INF/java/Parser.inc"/>
<arg value="META-INF/java/Protocol.inc"/>
<arg value="META-INF/java/SimpleParser.inc"/>
<fileset dir="${serverDir}">
<include name="META-INF/java/JavaProxy.inc"/>
</fileset>
</apply>
<copy file="${resDir}/META-INF/java/Java.inc" todir="${webappDir}/java/Java.inc"/>
</target>
<target name="genJavaProxyPhp" depends="genJavaInc,genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="${serverDir}/buildJavaProxy.php"/>
<arg value="${resDir}/META-INF/java/JavaProxy.php"/>
<fileset dir="${resDir}">
<include name="META-INF/java/Java.inc"/>
</fileset>
</apply>
<copy file="${resDir}/META-INF/java/JavaProxy.php" todir="${webappDir}/java/JavaProxy.php"/>
</target>
<target name="genJavaIncJava" depends="genJavaInc,genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="buildClassFromTextFile.php"/>
<arg value="${pkgDir}/bridge/JavaInc.java"/>
<arg value="JavaInc"/>
<fileset dir="${resDir}">
<include name="META-INF/java/Java.inc"/>
</fileset>
</apply>
</target>
<target name="genJavaProxyPhpJava" depends="genJavaProxyPhp,genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="buildClassFromTextFile.php"/>
<arg value="${pkgDir}/bridge/JavaProxy.java"/>
<arg value="JavaProxy"/>
<fileset dir="${resDir}">
<include name="META-INF/java/JavaProxy.php"/>
</fileset>
</apply>
</target>
<target name="genLauncherUnix" depends="genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="buildClassFromTextFile.php"/>
<arg value="${pkgDir}/bridge/LauncherUnix.java"/>
<arg value="LauncherUnix"/>
<fileset dir="${serverDir}">
<include name="WEB-INF/cgi/launcher.sh"/>
</fileset>
</apply>
</target>
<target name="genLauncherWindows" depends="genInit">
<apply executable="${php_exec}" failonerror="true" dir="${serverDir}" parallel="true">
<arg value="buildLauncherWindows.php"/>
<arg value="${pkgDir}/bridge" />
<fileset dir="${serverDir}">
<include name="WEB-INF/cgi/launcher.exe"/>
</fileset>
</apply>
</target>
<target name="genAll" depends="genLauncherWindows,genLauncherUnix,genJavaProxyPhpJava,genJavaIncJava">
</target>

<!-- legacy targets with wrong file paths: to be removed; do not use!

<target name="init">
<property name="javaBaseDir" value="${basedir}/server"/>
<property name="javaSourceDir" value="${javaBaseDir}"/>
Expand All @@ -19,11 +113,6 @@
<mkdir dir="${distDir}"/>
<mkdir dir="${javaClassDir}"/>
</target>

<!--
Clean task have been renamed to cleanBuild
for compatibility with gradle
-->
<target name="cleanBuild" depends="init">
<delete dir="server/documentation"/>
<delete dir="documentation"/>
Expand All @@ -40,7 +129,6 @@
<delete file="server/php/java/bridge/LauncherWindows3.java"/>
<delete file="server/php/java/bridge/LauncherWindows4.java"/>
</target>

<target name="compile" depends="init,JavaIncJava,JavaProxyPhpJava,PhpDebuggerPHPJava,LauncherUnix,LauncherWindows">
<javac srcdir="${javaSourceDir}" source="1.7" target="1.7" destdir="${javaClassDir}" debug="true"
deprecation="true">
Expand Down Expand Up @@ -285,4 +373,6 @@
depends="JavaBridgeTemplateWar,JavaBridgeWar">
</target>

-->

</project>
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 changes: 0 additions & 7 deletions server/.classpath

This file was deleted.

2 changes: 1 addition & 1 deletion server/buildClassFromTextFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$s.='""';

$str=<<<EOF
package php.java.bridge;
package io.soluble.pjb.bridge;
public class $argv[2] {
private static final String data = ${s};
public static final byte[] bytes = data.getBytes();
Expand Down
13 changes: 7 additions & 6 deletions server/buildLauncherWindows.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

function createOutfile($name) {
$file = fopen("php/java/bridge/${name}.java", "wb") or die("fopen");

function createOutfile($name, $path) {
$filePath = "${path}/${name}.java";
$file = fopen($filePath, "wb") or die("fopen");
$str =<<<HEAD_OUTFILE
package php.java.bridge;
package io.soluble.pjb.bridge;
public class ${name} {
public static final byte[] bytes = new byte[]{

Expand All @@ -27,11 +28,11 @@ function finishOutfile($file) {
$counter = 0;
$linectr = 1;

$file = fopen($argv[1], "rb") or die("fopen");
$file = fopen($argv[2], "rb") or die("fopen");
for ($byte=fread($file,1); !feof($file); $byte=fread($file, 1)) {
if ($counter%FILE_LENGTH==0) {
if(isset($outfile)) finishOutfile($outfile);
$outfile = createOutfile($names[(int)($counter/FILE_LENGTH)]);
$outfile = createOutfile($names[(int)($counter/FILE_LENGTH)], $argv[1]);
$linectr = 1;
}
fprintf($outfile, "(byte)0%o,%s", ord($byte), $linectr%16?" ":"\n");
Expand Down
Loading