diff --git a/install/.gitignore b/install/.gitignore index 3ea1601d5..dfa145145 100644 --- a/install/.gitignore +++ b/install/.gitignore @@ -1,2 +1,3 @@ # Ignore any generated files -temp/ \ No newline at end of file +temp/ +*.zip diff --git a/install/Dockerfile b/install/Dockerfile new file mode 100644 index 000000000..a55d36307 --- /dev/null +++ b/install/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.10.8 + +ARG cobra_commit=117d0983848468747dd3c7ab0699b230347b1db5 +ARG pyffi_commit=4b18387137a4e73386f020fff66d033354ab2186 +ARG nifxml_commit=89d03ffe69254ef4b3b58b0a22ec2ff9820b2e63 + +WORKDIR /codegen +RUN git clone https://github.com/OpenNaja/cobra-tools.git && cd cobra-tools && git reset --hard $cobra_commit && cd .. +RUN git clone https://github.com/Candoran2/new-pyffi && cd new-pyffi && git reset --hard $pyffi_commit && cd .. && \ + mv ./new-pyffi/formats/nif ./cobra-tools/source/formats && \ + mv ./new-pyffi/spells ./cobra-tools/source && \ + mv ./new-pyffi/utils ./cobra-tools/source +RUN git clone https://github.com/niftools/nifxml.git && cd nifxml && git reset --hard $nifxml_commit && cd .. && \ + mv ./nifxml/nif.xml ./cobra-tools/source/formats/nif + +WORKDIR cobra-tools +RUN python3 -m pip install --upgrade pip setuptools && \ + python3 -m pip install -r requirements.txt + +ADD generate.sh . +CMD ["./generate.sh"] diff --git a/install/docker-compose.yml b/install/docker-compose.yml new file mode 100644 index 000000000..ca520c9d0 --- /dev/null +++ b/install/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3.9" + +services: + codegen: + build: . + volumes: + - ./temp/io_scene_niftools/dependencies:/output diff --git a/install/generate.sh b/install/generate.sh new file mode 100644 index 000000000..58d89b3ca --- /dev/null +++ b/install/generate.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +python3 codegen.py +rm -r /output/* +mkdir -p /output/generated/formats +cd /codegen/cobra-tools/generated || exit 1 +# Everything is ~4.3MB while just taking the formats we need is just ~2.8MB +mv ./formats/base /output/generated/formats +mv ./formats/dds /output/generated/formats +mv ./formats/nif /output/generated/formats +mv ./spells /output/generated +mv ./utils /output/generated +echo "Done" +exit diff --git a/install/makezip.bat b/install/makezip.bat index 9fc8b2895..69ea8b334 100644 --- a/install/makezip.bat +++ b/install/makezip.bat @@ -25,6 +25,7 @@ xcopy /s "%ROOT%\io_scene_niftools" io_scene_niftools mkdir "%DEPS%" python -m pip install "PyFFI==%PYFFI_VERSION%" --target="%DEPS%" +docker compose up || exit 1 xcopy "%ROOT%"\AUTHORS.rst io_scene_niftools xcopy "%ROOT%"\CHANGELOG.rst io_scene_niftools diff --git a/install/makezip.sh b/install/makezip.sh index 11a5ba603..69e71e290 100755 --- a/install/makezip.sh +++ b/install/makezip.sh @@ -32,6 +32,7 @@ cp -r "${ADDON_IN}" "${ADDON_OUT}" echo "Creating dependencies folder ${DEPS_OUT:-${BUILD_DIR}/dependencies}" #python -m pip install -i https://test.pypi.org/simple/ PyFFI==2.2.4.dev5 --target="${DEPS_OUT:-${BUILD_DIR}/dependencies}" python -m pip install "PyFFI==${PYFFI_VERSION}" --target="${DEPS_OUT:-${BUILD_DIR}/dependencies}" +docker compose up || exit 1 echo "Copying loose files" cp "${ROOT}"/AUTHORS.rst "${ADDON_OUT}"