Skip to content

Commit

Permalink
ant macro to detect make/rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
akozlova committed Jan 10, 2017
1 parent f809707 commit 5880b3a
Show file tree
Hide file tree
Showing 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;
}
}
Expand Up @@ -76,6 +76,7 @@ private MacroManager() {
registerMacro(new ModuleFileDirMacro());
registerMacro(new ModuleNameMacro());
registerMacro(new AffectedModuleNamesMacro());
registerMacro(new CompilerContextMakeMacro());
registerMacro(new ModulePathMacro());
registerMacro(new ModuleSdkPathMacro());

Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -107,6 +107,7 @@ public class PathMacrosImpl extends PathMacros implements PersistentStateCompone
"ModuleFilePath",
"ModuleName",
"AffectedModuleNames",
"IsMake",
"ModuleSourcePath",
"ModuleSdkPath",
"OutputPath",
Expand Down
Expand Up @@ -98,6 +98,7 @@ private static DataContext createDataContext(CompileContext context) {
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);
}

Expand Down

0 comments on commit 5880b3a

Please sign in to comment.