Upgraded build system, and introduced start of map selection modes.
This commit is contained in:
parent
9b6eb7b667
commit
1cf5ed50fc
|
@ -32,6 +32,8 @@ const LOG_DIR = "./log";
|
||||||
const API_LOG = LOG_DIR ~ "/api_build.txt";
|
const API_LOG = LOG_DIR ~ "/api_build.txt";
|
||||||
const APP_LOG = LOG_DIR ~ "/app_build.txt";
|
const APP_LOG = LOG_DIR ~ "/app_build.txt";
|
||||||
|
|
||||||
|
const GITHUB_PROPS_FILE = "github_token.properties";
|
||||||
|
|
||||||
int main(string[] args) {
|
int main(string[] args) {
|
||||||
string ver = getVersion();
|
string ver = getVersion();
|
||||||
if (ver is null) {
|
if (ver is null) {
|
||||||
|
@ -135,7 +137,7 @@ void createRelease(string ver, string description) {
|
||||||
data.object["generate_release_notes"] = JSONValue(false);
|
data.object["generate_release_notes"] = JSONValue(false);
|
||||||
|
|
||||||
auto rq = Request();
|
auto rq = Request();
|
||||||
auto props = Properties("github_token.properties");
|
auto props = Properties(GITHUB_PROPS_FILE);
|
||||||
string username = props["username"];
|
string username = props["username"];
|
||||||
string token = props["token"];
|
string token = props["token"];
|
||||||
rq.authenticator = new BasicAuthentication(username, token);
|
rq.authenticator = new BasicAuthentication(username, token);
|
||||||
|
@ -148,13 +150,21 @@ void createRelease(string ver, string description) {
|
||||||
string responseBody = cast(string) response.responseBody;
|
string responseBody = cast(string) response.responseBody;
|
||||||
JSONValue responseData = parseJSON(responseBody);
|
JSONValue responseData = parseJSON(responseBody);
|
||||||
print("Created release %s", responseData["url"].str);
|
print("Created release %s", responseData["url"].str);
|
||||||
// Use the "upload-asset.sh" script to upload the asset, since internal requests api is broken.
|
long releaseId = responseData["id"].integer;
|
||||||
string command = format!"./upload-asset.sh github_api_token=%s owner=andrewlalis repo=RailSignalAPI tag=v%s filename=%s"(
|
string uploadUrl = format!"https://uploads.github.com/repos/andrewlalis/RailSignalAPI/releases/%d/assets?name=%s"(
|
||||||
token,
|
releaseId,
|
||||||
ver,
|
"rail-signal-" ~ ver ~ ".jar"
|
||||||
"./target/rail-signal-" ~ ver ~ ".jar"
|
|
||||||
);
|
);
|
||||||
runOrQuit(command);
|
print("Uploading JAR file to %s", uploadUrl);
|
||||||
|
auto f = File("./target/rail-signal-" ~ ver ~ ".jar", "rb");
|
||||||
|
ulong assetSize = f.size();
|
||||||
|
rq.addHeaders(["Content-Length": format!"%d"(assetSize)]);
|
||||||
|
auto assetResponse = rq.post(uploadUrl, f.byChunk(4096));
|
||||||
|
if (assetResponse.code == 201) {
|
||||||
|
print("JAR file uploaded successfully.");
|
||||||
|
} else {
|
||||||
|
error("An error occurred while uploading the JAR file.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error("An error occurred while creating the release.");
|
error("An error occurred while creating the release.");
|
||||||
writeln(response.responseBody);
|
writeln(response.responseBody);
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>nl.andrewl</groupId>
|
<groupId>nl.andrewl</groupId>
|
||||||
<artifactId>rail-signal-api</artifactId>
|
<artifactId>rail-signal-api</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.3.0</version>
|
||||||
<name>rail-signal-api</name>
|
<name>rail-signal-api</name>
|
||||||
<description>A simple API for tracking rail traffic in signalled blocks.</description>
|
<description>A simple API for tracking rail traffic in signalled blocks.</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -14,6 +14,9 @@ const HOVER_RADIUS = 10;
|
||||||
|
|
||||||
export let LAST_MOUSE_POINT = null;
|
export let LAST_MOUSE_POINT = null;
|
||||||
|
|
||||||
|
const SELECTION_MODE_NORMAL = 1;
|
||||||
|
const SELECTION_MODE_CHOOSE = 2;
|
||||||
|
let selectionMode = SELECTION_MODE_NORMAL;
|
||||||
const componentSelectionListeners = new Map();
|
const componentSelectionListeners = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,8 +75,18 @@ function onMouseDown(event) {
|
||||||
* @param {MouseEvent} event
|
* @param {MouseEvent} event
|
||||||
*/
|
*/
|
||||||
function onMouseUp(event) {
|
function onMouseUp(event) {
|
||||||
const finishingDrag = camPanNonzero();
|
if (selectionMode === SELECTION_MODE_NORMAL) {
|
||||||
|
handleNormalSelectionMouseUp(event);
|
||||||
|
}
|
||||||
camPanFinish();
|
camPanFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the mouse up event in normal selection mode. This means changing the
|
||||||
|
* set of selected components.
|
||||||
|
* @param {MouseEvent} event
|
||||||
|
*/
|
||||||
|
function handleNormalSelectionMouseUp(event) {
|
||||||
if (MAP_COMPONENTS_HOVERED.length > 0) {
|
if (MAP_COMPONENTS_HOVERED.length > 0) {
|
||||||
if (!event.shiftKey) {// If the user isn't holding SHIFT, clear the set of selected components first.
|
if (!event.shiftKey) {// If the user isn't holding SHIFT, clear the set of selected components first.
|
||||||
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
|
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
|
||||||
|
@ -89,7 +102,7 @@ function onMouseUp(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentSelectionListeners.forEach(callback => callback(MAP_RAIL_SYSTEM.selectedComponents));
|
componentSelectionListeners.forEach(callback => callback(MAP_RAIL_SYSTEM.selectedComponents));
|
||||||
} else if (!finishingDrag) {
|
} else if (!camPanNonzero()) {
|
||||||
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
|
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue