summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-05-09 00:45:12 +0800
committerruki <[email protected]>2018-05-08 22:31:12 +0800
commit83b637ffca0600b44396621d4ae9d03ac6655e75 (patch)
tree2be9e912926b0834db2408a94074bab04eabba34
parentb9b5248e49194343fb1807f865770db8b79d5853 (diff)
fix load rule bug
-rw-r--r--tests/projects/qt/quickapp/src/qml.qrc2
-rw-r--r--tests/projects/qt/widgetapp/src/mainwindow.h2
-rw-r--r--tests/projects/qt/widgetapp/src/mainwindow.ui2
-rw-r--r--xmake/core/project/rule.lua2
-rw-r--r--xmake/rules/wdk/xmake.lua48
5 files changed, 45 insertions, 11 deletions
diff --git a/tests/projects/qt/quickapp/src/qml.qrc b/tests/projects/qt/quickapp/src/qml.qrc
index 5f6483ac3..ca3fce67a 100644
--- a/tests/projects/qt/quickapp/src/qml.qrc
+++ b/tests/projects/qt/quickapp/src/qml.qrc
@@ -1,4 +1,4 @@
-<RCC>
+<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
diff --git a/tests/projects/qt/widgetapp/src/mainwindow.h b/tests/projects/qt/widgetapp/src/mainwindow.h
index a3948a917..8e06f4918 100644
--- a/tests/projects/qt/widgetapp/src/mainwindow.h
+++ b/tests/projects/qt/widgetapp/src/mainwindow.h
@@ -1,6 +1,6 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-
+
#include <QMainWindow>
namespace Ui {
diff --git a/tests/projects/qt/widgetapp/src/mainwindow.ui b/tests/projects/qt/widgetapp/src/mainwindow.ui
index 6050363fa..1c59b695e 100644
--- a/tests/projects/qt/widgetapp/src/mainwindow.ui
+++ b/tests/projects/qt/widgetapp/src/mainwindow.ui
@@ -1,4 +1,4 @@
-<ui version="4.0">
+<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index d96eb2b84..7f8010d5d 100644
--- a/xmake/core/project/rule.lua
+++ b/xmake/core/project/rule.lua
@@ -297,6 +297,8 @@ function rule:do_load(target)
if on_load then
local ok, errors = sandbox.load(on_load, target)
cache[key] = {ok, errors}
+ else
+ cache[key] = {true}
end
end
diff --git a/xmake/rules/wdk/xmake.lua b/xmake/rules/wdk/xmake.lua
index 002a3d08e..c08ef757e 100644
--- a/xmake/rules/wdk/xmake.lua
+++ b/xmake/rules/wdk/xmake.lua
@@ -68,20 +68,42 @@ rule("wdk.inf")
end)
-- on build file
- on_build_file(function (target, sourcefile)
+ on_build_file(function (target, sourcefile, opt)
- -- copy file to target directory
+ -- imports
+ import("core.base.option")
+ import("core.project.depend")
+
+ -- the target file
local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".inf")
- os.cp(sourcefile, targetfile)
+
+ -- add clean files
+ target:data_add("wdk.cleanfiles", targetfile)
+
+ -- need build this object?
+ local dependfile = target:dependfile(targetfile)
+ local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {})
+ if not depend.is_changed(dependinfo, {lastmtime = os.mtime(targetfile)}) then
+ return
+ end
+
+ -- trace progress info
+ if option.get("verbose") then
+ cprint("${green}[%02d%%]:${dim} compiling.wdk.inf %s", opt.progress, sourcefile)
+ else
+ cprint("${green}[%02d%%]:${clear} compiling.wdk.inf %s", opt.progress, sourcefile)
+ end
-- get stampinf
local stampinf = target:data("wdk.stampinf")
-- update the timestamp
+ os.cp(sourcefile, targetfile)
os.vrunv(stampinf, {"-d", "*", "-a", is_arch("x64") and "arm64" or "x86", "-v", "*", "-f", targetfile}, {wildcards = false})
- -- add clean files
- target:data_add("wdk.cleanfiles", targetfile)
+ -- update files and values to the dependent file
+ dependinfo.files = {sourcefile}
+ depend.save(dependinfo, dependfile)
end)
-- define rule: tracewpp
@@ -117,15 +139,22 @@ rule("wdk.tracewpp")
end)
-- before build file
- before_build_file(function (target, sourcefile)
+ before_build_file(function (target, sourcefile, opt)
+
+ -- imports
+ import("core.base.option")
-- get tracewpp
local tracewpp = target:data("wdk.tracewpp")
-- get outputdir
local outputdir = target:data("wdk.tracewpp.outputdir")
- if not os.isdir(outputdir) then
- os.mkdir(outputdir)
+
+ -- trace progress info
+ if option.get("verbose") then
+ cprint("${green}[%02d%%]:${dim} compiling.wdk.tracewpp %s", opt.progress, sourcefile)
+ else
+ cprint("${green}[%02d%%]:${clear} compiling.wdk.tracewpp %s", opt.progress, sourcefile)
end
-- get configdir
@@ -146,6 +175,9 @@ rule("wdk.tracewpp")
table.insert(args, sourcefile)
-- update the timestamp
+ if not os.isdir(outputdir) then
+ os.mkdir(outputdir)
+ end
os.vrunv(tracewpp, args, {wildcards = false})
-- add includedirs