-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: migrating builds from Maven to Gradle (#49)
* for integrating sandbox based on JNI in the future * for performance of building * for enjoying a powerful building system
- Loading branch information
1 parent
e44b299
commit cf86862
Showing
16 changed files
with
515 additions
and
273 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
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ target/ | |
build/ | ||
out/ | ||
|
||
.gradle | ||
|
||
*.DS_Store | ||
*.class | ||
*.swp | ||
|
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 |
---|---|---|
@@ -1,41 +1,72 @@ | ||
FROM ubuntu:18.04 | ||
MAINTAINER SDUOJ-dev | ||
MAINTAINER SDUOJ-Team | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
COPY docker/sources.list /etc/apt/sources.list | ||
COPY docker/mavenSettings.xml /usr/share/maven/conf/settings.xml | ||
COPY docker/testlib /testlib.h | ||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait | ||
COPY docker/checkers/ /checkers/ | ||
|
||
ADD https://github.com/SDUOJ/docker-compose-wait/releases/download/2.7.3/wait /wait | ||
RUN mkdir /sduoj \ | ||
&& chmod +x /wait | ||
|
||
# install OS softwares | ||
RUN apt-get update \ | ||
&& apt-get install -y sudo git unzip wget libseccomp-dev libseccomp2 seccomp build-essential python3-pip python dosbox openjdk-8-jdk maven | ||
&& apt-get install -qq -y \ | ||
make=4.1-9.1ubuntu1 dosbox=0.74-4.3 cmake \ | ||
sudo git unzip wget libseccomp-dev libseccomp2 seccomp build-essential \ | ||
python3-pip python vim dos2unix openjdk-8-jdk \ | ||
&& mkdir /usr/share/maven/conf/logging \ | ||
&& ln -sf /usr/lib/jvm/java-8-openjdk-amd64/bin/java /usr/bin/java \ | ||
&& ln -sf /usr/lib/jvm/java-8-openjdk-amd64/bin/javac /usr/bin/javac | ||
|
||
RUN git clone https://github.com/SDUOJ/sduoj-sandbox.git \ | ||
&& cd sduoj-sandbox \ | ||
# compile and install sduoj-sandbox | ||
RUN wget -q -O /sduoj/sandbox.zip https://codeload.github.com/SDUOJ/sduoj-sandbox/zip/master \ | ||
&& unzip -o -q -d /sduoj /sduoj/sandbox.zip \ | ||
&& rm /sduoj/sandbox.zip \ | ||
&& cd /sduoj/sduoj-sandbox* \ | ||
&& make \ | ||
&& make install | ||
|
||
RUN ln -sf /usr/lib/jvm/java-8-openjdk-amd64/bin/java /usr/bin/java \ | ||
&& ln -sf /usr/lib/jvm/java-8-openjdk-amd64/bin/javac /usr/bin/javac \ | ||
&& mkdir /sduoj \ | ||
&& wget -O /sduoj/server.zip https://codeload.github.com/SDUOJ/sduoj-server/zip/master \ | ||
&& wget -O /sduoj/judger.zip https://codeload.github.com/SDUOJ/sduoj-judger/zip/master \ | ||
&& unzip -o -q -d /sduoj /sduoj/server.zip \ | ||
&& unzip -o -q -d /sduoj /sduoj/judger.zip \ | ||
&& mkdir /usr/share/maven/conf/logging \ | ||
&& cd /sduoj/sduoj-server-master \ | ||
&& mvn install \ | ||
&& cd /sduoj/sduoj-judger-master \ | ||
&& mvn package \ | ||
&& mv sduoj-judger-service/target/sduoj-judger.jar ../sduoj-judger.jar \ | ||
# download source code | ||
RUN wget -q -O /sduoj/server.zip https://codeload.github.com/SDUOJ/sduoj-server/zip/master \ | ||
&& wget -q -O /sduoj/judger.zip https://codeload.github.com/SDUOJ/sduoj-judger/zip/master \ | ||
&& unzip -o -q -d /sduoj/dockerWorkspace /sduoj/server.zip \ | ||
&& unzip -o -q -d /sduoj/dockerWorkspace /sduoj/judger.zip \ | ||
&& rm /sduoj/server.zip \ | ||
&& rm /sduoj/judger.zip | ||
|
||
# compile and install sduoj-server | ||
RUN cd /sduoj/dockerWorkspace/sduoj-server* \ | ||
&& chmod +x ./mvnw \ | ||
&& ./mvnw install \ | ||
--projects sduoj-submit/sduoj-submit-interface \ | ||
--projects sduoj-problem/sduoj-problem-interface \ | ||
--projects sduoj-filesys/sduoj-filesys-interface \ | ||
--also-make \ | ||
--no-transfer-progress \ | ||
--batch-mode \ | ||
-Dmaven.test.skip=true \ | ||
-T `nproc`\ | ||
# compile sduoj-judger | ||
&& cd /sduoj/dockerWorkspace/sduoj-judger* \ | ||
&& chmod +x ./gradlew \ | ||
&& ./gradlew build \ | ||
&& mv ./sduoj-judger-service/build/libs/sduoj-judger.jar /sduoj/sduoj-judger.jar \ | ||
# clean | ||
&& rm -rf ~/.m2 \ | ||
&& rm -rf /sduoj/sduoj-server-master \ | ||
&& rm -rf /sduoj/sduoj-judger-master \ | ||
&& apt-get purge -y maven \ | ||
&& chmod +x /wait | ||
&& rm -rf ~/.gradle \ | ||
&& rm -rf /sduoj/dockerWorkspace | ||
|
||
ENV NACOS_ADDR=nacos.oj.qd.sdu.edu.cn:8848 | ||
ENV ACTIVE=prod | ||
|
||
WORKDIR /sduoj | ||
|
||
CMD /wait \ | ||
&& java -jar sduoj-judger.jar --sduoj.config.nacos-addr=$NACOS_ADDR --sduoj.config.active=$ACTIVE > /sduoj/sduoj.log | ||
&& java -jar sduoj-judger.jar \ | ||
--sduoj.config.nacos-addr=$NACOS_ADDR \ | ||
--sduoj.config.active=$ACTIVE \ | ||
>> /sduoj/sduoj.log |
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,13 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
// Use the plugin portal to apply community plugins in convention plugins. | ||
gradlePluginPortal() | ||
} |
40 changes: 40 additions & 0 deletions
40
buildSrc/src/main/groovy/cn.edu.sdu.qd.oj.judger.java-conventions.gradle
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,40 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
id 'java' | ||
} | ||
|
||
group = 'cn.edu.sdu.qd.oj.judger' | ||
version = '1.0.0-SNAPSHOT' | ||
java.sourceCompatibility = JavaVersion.VERSION_1_8 | ||
java.targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
ext { | ||
lombokVersion = '1.18.12' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { | ||
url = uri('https://repo.maven.apache.org/maven2/') | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "org.projectlombok:lombok:$lombokVersion" | ||
annotationProcessor "org.projectlombok:lombok:$lombokVersion" | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
} |
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,2 @@ | ||
org.gradle.warning.mode=summary | ||
org.gradle.parallel=true |
Binary file not shown.
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,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.