ant macro to detect make/rebuild

This commit is contained in:
Anna.Kozlova
2017-01-10 15:43:36 +01:00
parent f809707949
commit 5880b3ac4f
5 changed files with 45 additions and 0 deletions
@@ -0,0 +1,41 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.macro;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.DataContext;
public final class CompilerContextMakeMacro extends Macro {
@Override
public String getName() {
return "IsMake";
}
@Override
public String getDescription() {
return IdeBundle.message("macro.compiler.context.is.make");
}
@Override
public String expand(DataContext dataContext) {
Object make = dataContext.getData("COMPILER_CONTEXT_MAKE");
if (make instanceof Boolean) {
return make.toString();
}
return null;
}
}
@@ -76,6 +76,7 @@ public final class MacroManager {
registerMacro(new ModuleFileDirMacro());
registerMacro(new ModuleNameMacro());
registerMacro(new AffectedModuleNamesMacro());
registerMacro(new CompilerContextMakeMacro());
registerMacro(new ModulePathMacro());
registerMacro(new ModuleSdkPathMacro());
@@ -494,6 +494,7 @@ macro.module.file.directory=The directory of the module file
macro.module.file.path=The path of the module file
macro.module.file.name=The name of the module file without extension
macro.affected.module.names=The names of the modules in the scope, comma separated
macro.compiler.context.is.make=Boolean value according to the performed compilation: true for make, false for force recompile
macro.module.source.path=Module source path
macro.output.path=Output path
macro.project.file.directory=The directory of the project file
@@ -107,6 +107,7 @@ public class PathMacrosImpl extends PathMacros implements PersistentStateCompone
"ModuleFilePath",
"ModuleName",
"AffectedModuleNames",
"IsMake",
"ModuleSourcePath",
"ModuleSdkPath",
"OutputPath",
@@ -98,6 +98,7 @@ public class AntToolwindowRegistrar extends AbstractProjectComponent {
dataMap.put(LangDataKeys.MODULE.getName(), modules[0]);
}
dataMap.put(LangDataKeys.MODULE_CONTEXT_ARRAY.getName(), modules);
dataMap.put("COMPILER_CONTEXT_MAKE", context.isMake());
return SimpleDataContext.getSimpleContext(dataMap, null);
}