Skip to content

Commit 1aa49b6

Browse files
committed
idea haxe project defines
1 parent b68c1f1 commit 1aa49b6

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# v0.2.5
22

3+
- Added possibility to add Idea haxe project defines
34

45
# v0.2.4
56

resources/idea/haxe.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project version="4">
3-
<component name="HaxeProjectSettings" defines="display,debug" />
3+
<component name="HaxeProjectSettings" defines="::haxeProjectDefines::" />
44
</project>

src/hxmake/idea/IdeaPlugin.hx

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ class IdeaPlugin extends Plugin {
44

55
function new() {}
66

7-
override function apply(module:Module) {
7+
// `configurator` will be called in root module
8+
override function apply(module:Module, ?configurator:IdeaProjectTask -> Void) {
89
module.set("idea", new IdeaData());
910
// if module is root
10-
if(module.parent == null) {
11-
module.task("idea", new IdeaProjectTask()).dependsOn("haxelib");
11+
if (module.parent == null) {
12+
var task = new IdeaProjectTask();
13+
if (configurator != null) configurator(task);
14+
module.task("idea", task).dependsOn("haxelib");
1215
}
1316
}
1417
}

src/hxmake/idea/IdeaProjectTask.hx

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class IdeaProjectTask extends Task {
1616
var _rootModule:Module;
1717
var _depCache:Map<String, IdeaLibraryInfo> = new Map();
1818

19+
public var projectDefines:Array<String> = ["debug", "idea", "display"];
20+
1921
public function new() {}
2022

2123
override public function run() {
@@ -96,7 +98,8 @@ class IdeaProjectTask extends Task {
9698

9799
var context = {
98100
modules: [],
99-
haxeSdkName: getHaxeSDKName()
101+
haxeSdkName: getHaxeSDKName(),
102+
haxeProjectDefines: this.projectDefines
100103
};
101104

102105
for (module in _modules) {

0 commit comments

Comments
 (0)