-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated bundled ModuleManager to 3.1.3 Updated bundled B9PartSwitch to 2.6.0 Updated bundled KerbalActuators to 1.7.1 Updated bundled DynamicBatteryStorage to 1.0.0 License change for non-art assets (MIT)
- Loading branch information
Showing
20 changed files
with
773 additions
and
25 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
build_scripts/* linguist-vendored |
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,7 @@ | ||
*.pyc | ||
.idea/ | ||
build/ | ||
tmp/ | ||
deploy/ | ||
build_scripts/version.txt | ||
build_scripts/changelog.md |
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,60 @@ | ||
language: python | ||
python: | ||
- 3.6 | ||
install: | ||
- pip install awscli boto3 requests requests_toolbelt | ||
branches: | ||
only: | ||
- master | ||
script: | ||
- python build_scripts/build.py | ||
before_deploy: | ||
- VERSION=$(cat build_scripts/version.txt) | ||
- CHANGELOG=$(cat build_scripts/changelog.md) | ||
- IFS='/'; BASENAME=($TRAVIS_REPO_SLUG); unset IFS; | ||
- RELEASE_NAME="${BASENAME[1]} $VERSION" | ||
- echo $VERSION | ||
- git config --local user.name "ChrisAdderley" | ||
- git config --local user.email "[email protected]" | ||
- git remote set-url origin https://ChrisAdderley:${GITHUB_OAUTH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git | ||
# Only tag if this is the first before_deploy (runs for all providers) | ||
- > | ||
if ! [ "$BEFORE_DEPLOY_RUN" ]; then | ||
export BEFORE_DEPLOY_RUN=1; | ||
git tag $VERSION; | ||
git push origin $VERSION; | ||
fi | ||
deploy: | ||
- provider: script | ||
script: python build_scripts/deploy.py --curse | ||
skip_cleanup: true | ||
on: | ||
condition: $TRAVIS_BRANCH = master | ||
- provider: script | ||
script: python build_scripts/deploy.py --spacedock | ||
skip_cleanup: true | ||
on: | ||
condition: $TRAVIS_BRANCH = master | ||
- provider: s3 | ||
access_key_id: $AWS_ACCESS_KEY_ID | ||
secret_access_key: $AWS_SECRET_ACCESS_KEY | ||
bucket: "nertea-ksp-modding-releases" | ||
local_dir: deploy | ||
skip_cleanup: true | ||
acl: public_read | ||
region: us-east-2 | ||
upload-dir: near-future-aeronautics | ||
on: | ||
condition: $TRAVIS_BRANCH = master | ||
- deploy: | ||
provider: releases | ||
api_key: $GITHUB_OAUTH_TOKEN | ||
file_glob: true | ||
file: deploy/* | ||
# Disabled because newlines break it | ||
#body: "$CHANGELOG" | ||
name: $RELEASE_NAME | ||
skip_cleanup: true | ||
on: | ||
tags: false | ||
condition: $TRAVIS_BRANCH = master |
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 |
---|---|---|
|
@@ -505,7 +505,6 @@ PART | |
key = 3.5 0.1 0 0 | ||
} | ||
} | ||
} | ||
MODULE | ||
{ | ||
name = ModuleB9PartSwitch | ||
|
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
Binary file not shown.
Binary file not shown.
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,160 @@ | ||
# Build script entrypoint | ||
import os | ||
import shutil | ||
import zipfile | ||
import zlib | ||
import sys | ||
from argparse import ArgumentParser | ||
|
||
from build_support.build_helpers import * | ||
from build_support.dependencies import download_dependency | ||
|
||
|
||
# Build paths | ||
TEMP_PATH = "tmp" | ||
BUILD_PATH = "build" | ||
DEPLOY_PATH = "deploy" | ||
|
||
# Root directoy files to keep in the archives | ||
VALID_FILES = ["changelog.txt", "readme.txt"] | ||
|
||
def build_nodep_release(version_data, mod_name): | ||
""" | ||
Builds the release zip with no included dependencies | ||
Inputs: | ||
version_data (dict): Contents of the .version file | ||
mod_name (str): name of the mod | ||
""" | ||
build_path = os.path.join(DEPLOY_PATH, | ||
f"{mod_name}_Core_" + "{MAJOR}_{MINOR}_{PATCH}".format(**version_data["VERSION"])) | ||
shutil.make_archive(build_path, 'zip', os.path.join(BUILD_PATH)) | ||
print(f"> Built {build_path}") | ||
|
||
def build_full_release(version_data, mod_name): | ||
""" | ||
Builds the release zip with a full set of required dependencies | ||
Inputs: | ||
version_data (dict): Contents of the .version file | ||
mod_name (str): name of the mod | ||
""" | ||
build_path = os.path.join(DEPLOY_PATH, | ||
f"{mod_name}_" + "{MAJOR}_{MINOR}_{PATCH}".format(**version_data["VERSION"])) | ||
shutil.make_archive(build_path, 'zip', os.path.join(BUILD_PATH)) | ||
print(f"> Built {build_path}") | ||
|
||
def build_extras(version_data, build_packages=False): | ||
""" | ||
Compiles and optionally builds packages for all Extras in the mod | ||
Inputs: | ||
version_data (dict): Contents of the .version file | ||
build_packages (bool): whether to create an individual zipfile for each package | ||
""" | ||
dirs = [name for name in os.listdir("Extras") if os.path.isdir(os.path.join("Extras", name))] | ||
|
||
for name in dirs: | ||
build_extra(name, version_data, build_packages) | ||
|
||
def build_extra(name, version_data, build_package): | ||
""" | ||
Compiles and optionally builds a single Extras package | ||
Inputs: | ||
name (str): name of the extra | ||
version_data (dict): Contents of the .version file | ||
build_package (bool): whether to create an individual zipfile for the package | ||
""" | ||
extra_path = os.path.join(DEPLOY_PATH, f"{name}" + "{MAJOR}_{MINOR}_{PATCH}".format(**version_data["VERSION"])) | ||
print(f"> Compiling Extra {name}") | ||
ensure_path(os.path.join(BUILD_PATH,"Extras")) | ||
shutil.copytree(os.path.join("Extras", name), os.path.join(BUILD_PATH,"Extras", name)) | ||
|
||
if build_package: | ||
print(f"> Building {name}") | ||
shutil.make_archive(extra_path, "zip", os.path.join(BUILD_PATH, "Extras", name)) | ||
print(f"> Built {extra_path}") | ||
|
||
def collect_dependencies(dep_data): | ||
""" | ||
Finds and downloads all the mod's dependencies | ||
Inputs: | ||
dep_data (dict): dictionart of dependecies from build_data.json | ||
""" | ||
clean_path(TEMP_PATH) | ||
for name, info in dep_data.items(): | ||
download_dependency(name, info, TEMP_PATH, BUILD_PATH) | ||
cleanup() | ||
|
||
def cleanup(): | ||
""" | ||
Cleans up the trailing files in the main directory for packaging by excluding all expect the | ||
specified items in VALID_FILES | ||
""" | ||
onlyfiles = [f for f in os.listdir(BUILD_PATH) if os.path.isfile(os.path.join(BUILD_PATH, f))] | ||
for f in onlyfiles: | ||
if f not in VALID_FILES: | ||
os.remove(os.path.join(BUILD_PATH,f)) | ||
|
||
def bundle(core_release, extras_release, complete_release): | ||
""" | ||
Compiles and builds the set of release packages according to information from | ||
the .version file and the build_data.json file | ||
""" | ||
# Collect build information | ||
build_data = get_build_data() | ||
version_data = get_version_file_info(build_data["mod_name"]) | ||
|
||
print(f"Building {build_data['mod_name']} version {get_version(version_data)}\n=================") | ||
|
||
# Clean/recreate the build, deploy and temp paths | ||
clean_path(os.path.join(BUILD_PATH)) | ||
clean_path(os.path.join(DEPLOY_PATH)) | ||
clean_path(os.path.join(TEMP_PATH)) | ||
|
||
# Copy main mod content | ||
print(f"Compiling core mod content") | ||
shutil.copytree(os.path.join("GameData", build_data["mod_name"]), os.path.join(BUILD_PATH, "GameData", build_data["mod_name"])) | ||
shutil.copy("changelog.txt", os.path.join(BUILD_PATH, "changelog.txt")) | ||
shutil.copy("readme.txt", os.path.join(BUILD_PATH, "readme.txt")) | ||
|
||
if core_release: | ||
print(f"Building BASIC release package") | ||
build_nodep_release(version_data, build_data['mod_name']) | ||
|
||
if os.path.exists("Extras"): | ||
print(f"Compiling and building EXTRAS release packages") | ||
build_extras(version_data, extras_release) | ||
|
||
print(f"Compiling complete release package") | ||
print(f"> Collecting dependencies") | ||
collect_dependencies(build_data["dependencies"]) | ||
|
||
if complete_release: | ||
print(f"Building COMPLETE release package") | ||
build_full_release(version_data, build_data['mod_name']) | ||
|
||
# Write the version/changelog out in text for Travis deploy scripts to take advantage of as env variables set are not persisted | ||
with open(os.path.join("build_scripts", 'version.txt'), "w") as f: | ||
f.write(get_version(version_data)) | ||
|
||
with open(os.path.join("build_scripts", 'changelog.md'), "w") as f: | ||
f.write(get_changelog()) | ||
|
||
if __name__ == "__main__": | ||
parser = ArgumentParser() | ||
parser.add_argument("-c", "--complete", | ||
action="store_true", default=True, | ||
help="write complete package") | ||
parser.add_argument("-e", "--extras", | ||
action="store_true", default=False, | ||
help="write extras package") | ||
parser.add_argument("-b", "--basic", | ||
action="store_true", default=False, | ||
help="write basic no dependency package") | ||
|
||
args = parser.parse_args() | ||
|
||
bundle(args.basic, args.extras, args.complete) |
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,41 @@ | ||
{ | ||
"mod_name": "NearFutureAeronautics", | ||
"dependencies": | ||
{ | ||
"B9PartSwitch": | ||
{ | ||
"version": "2.6.0", | ||
"location": "s3" | ||
}, | ||
"ModuleManager": | ||
{ | ||
"version": "3.1.3", | ||
"location": "s3" | ||
}, | ||
"CommunityResourcePack": | ||
{ | ||
"version": "1.0.0", | ||
"location": "s3" | ||
}, | ||
"KerbalActuators": | ||
{ | ||
"version": "1.7.1", | ||
"location": "s3", | ||
"gamedata-name": "WildBlueIndustries" | ||
}, | ||
"DeployableEngines": | ||
{ | ||
"location": "github", | ||
"repository": "ChrisAdderley/DeployableEngines", | ||
"tag": "1.0.0" | ||
} | ||
}, | ||
"spacedock": | ||
{ | ||
"mod-id": 1957 | ||
}, | ||
"curseforge": | ||
{ | ||
"mod-id": 301919 | ||
} | ||
} |
Empty file.
Oops, something went wrong.