mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build scripts: removed obsolete 'moduleLoader' script
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
*/
|
||||
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.util.containers.hash.HashMap
|
||||
import org.jetbrains.jps.model.JpsElementFactory
|
||||
import org.jetbrains.jps.model.java.JpsJavaModuleType
|
||||
import org.jetbrains.jps.model.java.JpsJavaSdkType
|
||||
import org.jetbrains.jps.model.serialization.JDomSerializationUtil
|
||||
import org.jetbrains.jps.model.serialization.JpsMacroExpander
|
||||
import org.jetbrains.jps.model.serialization.PathMacroUtil
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
//todo[nik] use 'addModule' from JpsGantTool instead after next update of standalone JPS jars
|
||||
binding.setVariable("loadModule", {File moduleFile ->
|
||||
def moduleName = FileUtil.getNameWithoutExtension(moduleFile)
|
||||
def module = JpsElementFactory.instance.createModule(moduleName, JpsJavaModuleType.INSTANCE, JpsElementFactory.instance.createDummyElement())
|
||||
def expander = createModuleMacroExpander(new HashMap<String, String>(), moduleFile)
|
||||
def rootElement = JDOMUtil.load(moduleFile)
|
||||
expander.substitute(rootElement, SystemInfo.isFileSystemCaseSensitive)
|
||||
JpsModuleRootModelSerializer.loadRootModel(module, JDomSerializationUtil.findComponent(rootElement, "NewModuleRootManager"),
|
||||
JpsJavaSdkType.INSTANCE)
|
||||
project.addModule(module)
|
||||
projectBuilder.info("Module $moduleName loaded")
|
||||
return module
|
||||
})
|
||||
|
||||
private JpsMacroExpander createModuleMacroExpander(final Map<String, String> pathVariables, File moduleFile) {
|
||||
final JpsMacroExpander expander = new JpsMacroExpander(pathVariables)
|
||||
def moduleDirPath = PathMacroUtil.getModuleDir(moduleFile.getAbsolutePath())
|
||||
if (moduleDirPath != null) {
|
||||
expander.addFileHierarchyReplacements(PathMacroUtil.MODULE_DIR_MACRO_NAME, new File(FileUtil.toSystemDependentName(moduleDirPath)))
|
||||
}
|
||||
return expander
|
||||
}
|
||||
Reference in New Issue
Block a user